i have a gridview with columns task_no,date,university,spoken,medium ,time and a template field column - total_time.
the column 'time' has a label in the item template and a textbox in the edititemtemplate..
the column 'total_time' has a label in the item template..
what i need is :-
1) value of time should be the value of total_time..
2)as i change the value of time during EDIT,that value should be added up to the value of total_time..
this should be done for each row..
my source code and code behind is :
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data.SqlTypes;
public partial class DisplayEntry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GridView1.Visible = true;
if (!IsPostBack)
{
ddlUniv_SelectedIndexChanged(sender, e);
ddlMedium_SelectedIndexChanged(sender, e);
ddlUnivv_SelectedIndexChanged(sender, e);
ddlMediumm_SelectedIndexChanged(sender, e);
ProCon p = new ProCon();
try
{
DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter();
p.cmd.CommandText = "select * from entry_mast";
adp.SelectCommand = p.cmd;
dt.Clear();
adp.Fill(dt);
// GridView1.DataSource = dt;
GridView1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
GridView1.ShowFooter = true;
long t;
string dt, sp;
decimal tt;
TextBox tb = (TextBox)(GridView1.FooterRow.FindControl("txtTaskNo"));
t = Convert.ToInt64(tb.Text);
tb = (TextBox)(GridView1.FooterRow.FindControl("txtDate"));
dt = tb.Text;
tb = (TextBox)(GridView1.FooterRow.FindControl("txtSpoken"));
sp = tb.Text;
tb = (TextBox)(GridView1.FooterRow.FindControl("txtTime"));
tt = Convert.ToDecimal(tb.Text);
DropDownList ddlUniv = (DropDownList)GridView1.FooterRow.Cells[2].FindControl("ddlUniv");
DropDownList ddlMedium = (DropDownList)GridView1.FooterRow.Cells[4].FindControl("ddlMedium");
SqlDataSource1.InsertParameters[0].DefaultValue = t.ToString();
SqlDataSource1.InsertParameters[1].DefaultValue = dt;
SqlDataSource1.InsertParameters[3].DefaultValue = sp;
SqlDataSource1.InsertParameters[5].DefaultValue = tt.ToString();
SqlDataSource1.InsertParameters[2].DefaultValue = ddlUniv.SelectedValue;
SqlDataSource1.InsertParameters[4].DefaultValue = ddlMedium.SelectedValue;
SqlDataSource1.Insert();
Response.Write("SAVED");
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
protected void ddlUniv_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlUniv = new DropDownList();
Response.Write(ddlUniv.SelectedValue);
ddlUniv.Items.Clear();
}
protected void ddlUnivv_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlUniv = new DropDownList();
Response.Write(ddlUniv.SelectedValue);
}
protected void ddlMediumm_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlMedium = new DropDownList();
Response.Write(ddlMedium.SelectedValue);
}
protected void ddlMedium_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlMedium = new DropDownList();
Response.Write(ddlMedium.SelectedValue);
}
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
ProCon p=new ProCon();
p.cnn.Open();
SqlCommand mydelete = new SqlCommand("delete from entry_mast where task_no=@task_no",p.cnn);
mydelete.CommandType = CommandType.Text;
mydelete.Parameters.Add("@task_no", SqlDbType.BigInt).Value = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
mydelete.ExecuteNonQuery();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
}
decimal total_time;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label lblTime = (Label)e.Row.FindControl("lblTime");
decimal time = Decimal.Parse(lblTime.Text);
Label lblTOT = (Label)e.Row.FindControl("lblTOT");
lblTOT.Text= time.ToString();
total_time += time;
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
protected void txtTime_TextChanged(object sender, EventArgs e)
{
}
}using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Collections;
using System.Configuration;
using System.Data.SqlClient;
using System.Data.Sql;
using System.Data.SqlTypes;
public partial class DisplayEntry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GridView1.Visible = true;
if (!IsPostBack)
{
ddlUniv_SelectedIndexChanged(sender, e);
ddlMedium_SelectedIndexChanged(sender, e);
ddlUnivv_SelectedIndexChanged(sender, e);
ddlMediumm_SelectedIndexChanged(sender, e);
ProCon p = new ProCon();
try
{
DataTable dt = new DataTable();
SqlDataAdapter adp = new SqlDataAdapter();
p.cmd.CommandText = "select * from entry_mast";
adp.SelectCommand = p.cmd;
dt.Clear();
adp.Fill(dt);
// GridView1.DataSource = dt;
GridView1.DataBind();
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
GridView1.ShowFooter = true;
long t;
string dt, sp;
decimal tt;
TextBox tb = (TextBox)(GridView1.FooterRow.FindControl("txtTaskNo"));
t = Convert.ToInt64(tb.Text);
tb = (TextBox)(GridView1.FooterRow.FindControl("txtDate"));
dt = tb.Text;
tb = (TextBox)(GridView1.FooterRow.FindControl("txtSpoken"));
sp = tb.Text;
tb = (TextBox)(GridView1.FooterRow.FindControl("txtTime"));
tt = Convert.ToDecimal(tb.Text);
DropDownList ddlUniv = (DropDownList)GridView1.FooterRow.Cells[2].FindControl("ddlUniv");
DropDownList ddlMedium = (DropDownList)GridView1.FooterRow.Cells[4].FindControl("ddlMedium");
SqlDataSource1.InsertParameters[0].DefaultValue = t.ToString();
SqlDataSource1.InsertParameters[1].DefaultValue = dt;
SqlDataSource1.InsertParameters[3].DefaultValue = sp;
SqlDataSource1.InsertParameters[5].DefaultValue = tt.ToString();
SqlDataSource1.InsertParameters[2].DefaultValue = ddlUniv.SelectedValue;
SqlDataSource1.InsertParameters[4].DefaultValue = ddlMedium.SelectedValue;
SqlDataSource1.Insert();
Response.Write("SAVED");
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
protected void ddlUniv_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlUniv = new DropDownList();
Response.Write(ddlUniv.SelectedValue);
ddlUniv.Items.Clear();
}
protected void ddlUnivv_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlUniv = new DropDownList();
Response.Write(ddlUniv.SelectedValue);
}
protected void ddlMediumm_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlMedium = new DropDownList();
Response.Write(ddlMedium.SelectedValue);
}
protected void ddlMedium_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddlMedium = new DropDownList();
Response.Write(ddlMedium.SelectedValue);
}
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
ProCon p=new ProCon();
p.cnn.Open();
SqlCommand mydelete = new SqlCommand("delete from entry_mast where task_no=@task_no",p.cnn);
mydelete.CommandType = CommandType.Text;
mydelete.Parameters.Add("@task_no", SqlDbType.BigInt).Value = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString());
mydelete.ExecuteNonQuery();
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
protected void GridView1_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
}
decimal total_time;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
Label lblTime = (Label)e.Row.FindControl("lblTime");
decimal time = Decimal.Parse(lblTime.Text);
Label lblTOT = (Label)e.Row.FindControl("lblTOT");
lblTOT.Text= time.ToString();
total_time += time;
}
}
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
}
protected void txtTime_TextChanged(object sender, EventArgs e)
{
}
}
source code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisplayEntry.aspx.cs" Inherits="DisplayEntry" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<%--<script type="text/javascript">
function UpdateLabel() {
document.getElementById('lblTOT').innerText = document.getElementById('txtTime').value;
}
</script>
--%>
</head>
<body>
<form id="form1" runat="server">
<div>
<%-- <asp:Label ID="lblTOT" runat="server" Text="0"></asp:Label>
<asp:TextBox ID="txtTime" runat="server" onblur="UpdateLabel();" onkeyup="UpdateLabel();">
</asp:TextBox>
--%>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="task_no" DataSourceID="SqlDataSource1"
EnableModelValidation="True" ShowFooter="True"
style="z-index: 1; left: 104px; top: 148px; position: absolute; height: 133px; width: 187px"
onpageindexchanging="GridView1_PageIndexChanging"
onrowdatabound="GridView1_RowDataBound" onrowdeleted="GridView1_RowDeleted"
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" OnRowCommand="GridView1_RowCommand"
onrowupdated="GridView1_RowUpdated" onrowupdating="GridView1_RowUpdating"
onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
CellPadding="3" GridLines="Horizontal" PageSize="3"
>
<AlternatingRowStyle BackColor="#F7F7F7" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" DeleteText="Delete" EditText="Edit" />
<asp:TemplateField HeaderText="task_no" SortExpression="task_no">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("task_no") %>'></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtTaskNo" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("task_no") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="date" SortExpression="date">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("date") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="university" SortExpression="university">
<EditItemTemplate>
<asp:DropDownList ID="ddlUnivv" runat="server" AutoPostBack="True"
SelectedValue='<%# Bind("university") %>'
onselectedindexchanged="ddlUnivv_SelectedIndexChanged">
<asp:ListItem>delhi</asp:ListItem>
<asp:ListItem>chennai</asp:ListItem>
<asp:ListItem>bombay</asp:ListItem>
<asp:ListItem>manipal</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlUniv" runat="server" AutoPostBack="True"
AppendDataBoundItems="True" EnableViewState="False"
OnSelectedIndexChanged="ddlUniv_SelectedIndexChanged"
>
<asp:ListItem>--select--</asp:ListItem>
<asp:ListItem>delhi</asp:ListItem>
<asp:ListItem>chennai</asp:ListItem>
<asp:ListItem>bombay</asp:ListItem>
<asp:ListItem>manipal</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("university") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="spoken" SortExpression="spoken">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("spoken") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSpoken" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("spoken") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="medium" SortExpression="medium">
<EditItemTemplate>
<asp:DropDownList ID="ddlMediumm" runat="server" AutoPostBack="True" SelectedValue='<%# Bind("medium") %>'
AppendDataBoundItems="True"
onselectedindexchanged="ddlMediumm_SelectedIndexChanged" >
<asp:ListItem>Web</asp:ListItem>
<asp:ListItem>Mail</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlMedium" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
EnableViewState="False"
onselectedindexchanged="ddlMedium_SelectedIndexChanged">
<asp:ListItem>--select--</asp:ListItem>
<asp:ListItem>Web</asp:ListItem>
<asp:ListItem>Mail</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("medium") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="time" SortExpression="time">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("time") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtTime" runat="server" ></asp:TextBox>
<asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save"
Width="64px" />
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblTime" runat="server" Text='<%# Bind("time") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="tot_time">
<ItemTemplate>
<asp:Label ID="lblTOT" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:con %>"
SelectCommand="SELECT * FROM [entry_mast]"
ConflictDetection="CompareAllValues"
DeleteCommand="DELETE FROM [entry_mast] WHERE [task_no] = @original_task_no AND (([date] = @original_date) OR ([date] IS NULL AND @original_date IS NULL)) AND (([university] = @original_university) OR ([university] IS NULL AND @original_university IS NULL)) AND (([spoken] = @original_spoken) OR ([spoken] IS NULL AND @original_spoken IS NULL)) AND (([medium] = @original_medium) OR ([medium] IS NULL AND @original_medium IS NULL)) AND (([time] = @original_time) OR ([time] IS NULL AND @original_time IS NULL))"
InsertCommand="INSERT INTO [entry_mast] ([task_no], [date], [university], [spoken], [medium], [time]) VALUES (@task_no, @date, @university, @spoken, @medium, @time)"
OldValuesParameterFormatString="original_{0}"
UpdateCommand="UPDATE [entry_mast] SET [date] = @date, [university] = @university, [spoken] = @spoken, [medium] = @medium, [time] = @time WHERE [task_no] = @original_task_no AND (([date] = @original_date) OR ([date] IS NULL AND @original_date IS NULL)) AND (([university] = @original_university) OR ([university] IS NULL AND @original_university IS NULL)) AND (([spoken] = @original_spoken) OR ([spoken] IS NULL AND @original_spoken IS NULL)) AND (([medium] = @original_medium) OR ([medium] IS NULL AND @original_medium IS NULL)) AND (([time] = @original_time) OR ([time] IS NULL AND @original_time IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_task_no" Type="Int64" />
<asp:Parameter Name="original_date" Type="String" />
<asp:Parameter Name="original_university" Type="String" />
<asp:Parameter Name="original_spoken" Type="String" />
<asp:Parameter Name="original_medium" Type="String" />
<asp:Parameter Name="original_time" Type="Decimal" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="task_no" Type="Int64" />
<asp:Parameter Name="date" Type="String" />
<asp:Parameter Name="university" Type="String" />
<asp:Parameter Name="spoken" Type="String" />
<asp:Parameter Name="medium" Type="String" />
<asp:Parameter Name="time" Type="Decimal" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="date" Type="String" />
<asp:Parameter Name="university" Type="String" />
<asp:Parameter Name="spoken" Type="String" />
<asp:Parameter Name="medium" Type="String" />
<asp:Parameter Name="time" Type="Decimal" />
<asp:Parameter Name="original_task_no" Type="Int64" />
<asp:Parameter Name="original_date" Type="String" />
<asp:Parameter Name="original_university" Type="String" />
<asp:Parameter Name="original_spoken" Type="String" />
<asp:Parameter Name="original_medium" Type="String" />
<asp:Parameter Name="original_time" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DisplayEntry.aspx.cs" Inherits="DisplayEntry" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<%--<script type="text/javascript">
function UpdateLabel() {
document.getElementById('lblTOT').innerText = document.getElementById('txtTime').value;
}
</script>
--%>
</head>
<body>
<form id="form1" runat="server">
<div>
<%-- <asp:Label ID="lblTOT" runat="server" Text="0"></asp:Label>
<asp:TextBox ID="txtTime" runat="server" onblur="UpdateLabel();" onkeyup="UpdateLabel();">
</asp:TextBox>
--%>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="task_no" DataSourceID="SqlDataSource1"
EnableModelValidation="True" ShowFooter="True"
style="z-index: 1; left: 104px; top: 148px; position: absolute; height: 133px; width: 187px"
onpageindexchanging="GridView1_PageIndexChanging"
onrowdatabound="GridView1_RowDataBound" onrowdeleted="GridView1_RowDeleted"
onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing" OnRowCommand="GridView1_RowCommand"
onrowupdated="GridView1_RowUpdated" onrowupdating="GridView1_RowUpdating"
onselectedindexchanged="GridView1_SelectedIndexChanged" AllowPaging="True"
BackColor="White" BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
CellPadding="3" GridLines="Horizontal" PageSize="3"
>
<AlternatingRowStyle BackColor="#F7F7F7" />
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" DeleteText="Delete" EditText="Edit" />
<asp:TemplateField HeaderText="task_no" SortExpression="task_no">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("task_no") %>'></asp:Label>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtTaskNo" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("task_no") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="date" SortExpression="date">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("date") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtDate" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="university" SortExpression="university">
<EditItemTemplate>
<asp:DropDownList ID="ddlUnivv" runat="server" AutoPostBack="True"
SelectedValue='<%# Bind("university") %>'
onselectedindexchanged="ddlUnivv_SelectedIndexChanged">
<asp:ListItem>delhi</asp:ListItem>
<asp:ListItem>chennai</asp:ListItem>
<asp:ListItem>bombay</asp:ListItem>
<asp:ListItem>manipal</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlUniv" runat="server" AutoPostBack="True"
AppendDataBoundItems="True" EnableViewState="False"
OnSelectedIndexChanged="ddlUniv_SelectedIndexChanged"
>
<asp:ListItem>--select--</asp:ListItem>
<asp:ListItem>delhi</asp:ListItem>
<asp:ListItem>chennai</asp:ListItem>
<asp:ListItem>bombay</asp:ListItem>
<asp:ListItem>manipal</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Eval("university") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="spoken" SortExpression="spoken">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("spoken") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtSpoken" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("spoken") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="medium" SortExpression="medium">
<EditItemTemplate>
<asp:DropDownList ID="ddlMediumm" runat="server" AutoPostBack="True" SelectedValue='<%# Bind("medium") %>'
AppendDataBoundItems="True"
onselectedindexchanged="ddlMediumm_SelectedIndexChanged" >
<asp:ListItem>Web</asp:ListItem>
<asp:ListItem>Mail</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
<FooterTemplate>
<asp:DropDownList ID="ddlMedium" runat="server" AutoPostBack="True" AppendDataBoundItems="True"
EnableViewState="False"
onselectedindexchanged="ddlMedium_SelectedIndexChanged">
<asp:ListItem>--select--</asp:ListItem>
<asp:ListItem>Web</asp:ListItem>
<asp:ListItem>Mail</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Eval("medium") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="time" SortExpression="time">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("time") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtTime" runat="server" ></asp:TextBox>
<asp:Button ID="btnSave" runat="server" onclick="btnSave_Click" Text="Save"
Width="64px" />
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblTime" runat="server" Text='<%# Bind("time") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="tot_time">
<ItemTemplate>
<asp:Label ID="lblTOT" runat="server" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:con %>"
SelectCommand="SELECT * FROM [entry_mast]"
ConflictDetection="CompareAllValues"
DeleteCommand="DELETE FROM [entry_mast] WHERE [task_no] = @original_task_no AND (([date] = @original_date) OR ([date] IS NULL AND @original_date IS NULL)) AND (([university] = @original_university) OR ([university] IS NULL AND @original_university IS NULL)) AND (([spoken] = @original_spoken) OR ([spoken] IS NULL AND @original_spoken IS NULL)) AND (([medium] = @original_medium) OR ([medium] IS NULL AND @original_medium IS NULL)) AND (([time] = @original_time) OR ([time] IS NULL AND @original_time IS NULL))"
InsertCommand="INSERT INTO [entry_mast] ([task_no], [date], [university], [spoken], [medium], [time]) VALUES (@task_no, @date, @university, @spoken, @medium, @time)"
OldValuesParameterFormatString="original_{0}"
UpdateCommand="UPDATE [entry_mast] SET [date] = @date, [university] = @university, [spoken] = @spoken, [medium] = @medium, [time] = @time WHERE [task_no] = @original_task_no AND (([date] = @original_date) OR ([date] IS NULL AND @original_date IS NULL)) AND (([university] = @original_university) OR ([university] IS NULL AND @original_university IS NULL)) AND (([spoken] = @original_spoken) OR ([spoken] IS NULL AND @original_spoken IS NULL)) AND (([medium] = @original_medium) OR ([medium] IS NULL AND @original_medium IS NULL)) AND (([time] = @original_time) OR ([time] IS NULL AND @original_time IS NULL))">
<DeleteParameters>
<asp:Parameter Name="original_task_no" Type="Int64" />
<asp:Parameter Name="original_date" Type="String" />
<asp:Parameter Name="original_university" Type="String" />
<asp:Parameter Name="original_spoken" Type="String" />
<asp:Parameter Name="original_medium" Type="String" />
<asp:Parameter Name="original_time" Type="Decimal" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="task_no" Type="Int64" />
<asp:Parameter Name="date" Type="String" />
<asp:Parameter Name="university" Type="String" />
<asp:Parameter Name="spoken" Type="String" />
<asp:Parameter Name="medium" Type="String" />
<asp:Parameter Name="time" Type="Decimal" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="date" Type="String" />
<asp:Parameter Name="university" Type="String" />
<asp:Parameter Name="spoken" Type="String" />
<asp:Parameter Name="medium" Type="String" />
<asp:Parameter Name="time" Type="Decimal" />
<asp:Parameter Name="original_task_no" Type="Int64" />
<asp:Parameter Name="original_date" Type="String" />
<asp:Parameter Name="original_university" Type="String" />
<asp:Parameter Name="original_spoken" Type="String" />
<asp:Parameter Name="original_medium" Type="String" />
<asp:Parameter Name="original_time" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
</form>
</body>
</html>
i am getting same value for both time and total_time..
and when i try to edit, i am gettin error:Object reference not set to instance of an object..
however delete is workin fine :)
and when i try to edit, i am gettin error:Object reference not set to instance of an object..
however delete is workin fine :)
plzz help..its very very urgent!!