int total = 0; protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "salary")); } if (e.Row.RowType == DataControlRowType.Footer) { Label sallabel = (Label)e.Row.FindControl("sallabel"); sallabel.Text = total.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "ta")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblamount2 = (Label)e.Row.FindControl("talabel"); lblamount2.Text = total.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "contigency")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblamount3 = (Label)e.Row.FindControl("cnlabel"); lblamount3.Text = total.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "nrc")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblamount4 = (Label)e.Row.FindControl("nrclabel"); lblamount4.Text = total.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "institcharges")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblamount5 = (Label)e.Row.FindControl("iclabel"); lblamount5.Text = total.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { total += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "others")); } if (e.Row.RowType == DataControlRowType.Footer) { Label lblamount6 = (Label)e.Row.FindControl("olabel"); lblamount6.Text = total.ToString(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)