ASP.NET with C# and SQL SERVER , some vb.net . asp.net examples, asp.net codes, asp.net programs, c# code, sql server queries, important codes.
Thursday, 18 October 2012
Cell Calculation in Gridview in Asp.Net C#
======================================================================================
protected void txt_DebtPL_TextChanged(object sender, EventArgs e)
{
calculate_col(sender);
// DebitPL_Sum();
}
private void calculate_col(object sender)
{
TextBox txtCredit = sender as TextBox;
GridViewRow gvr = txtCredit.NamingContainer as GridViewRow;
TextBox txt1 = gvr.FindControl("txt_DebtPL") as TextBox;
TextBox txt2 = gvr.FindControl("txt_AC_Bal_Sheet") as TextBox;
TextBox txt3 = gvr.FindControl("txt_Reimbursement") as TextBox;
TextBox txt4 = gvr.FindControl("txt_AnyOtherhead") as TextBox;
TextBox txt5 = gvr.FindControl("txt_TotalPaymentMode") as TextBox;
double a1=0, a2=0, a3=0, a4=0, a5=0;
a1 = Convert.ToDouble(txt1.Text.Trim());
a2 = Convert.ToDouble(txt2.Text.Trim());
a3 = Convert.ToDouble(txt3.Text.Trim());
a4 = Convert.ToDouble(txt4.Text.Trim());
a5 = a1 + a2 + a3 + a4;
txt5.Text = a5.ToString();
=========================================================================================
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment