How to display addition on data grid column at datagrid footer?
for example
Name Salarty
aa 1000
bb 3200
vv 3000
ff 4000
sum=8000
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pranay RanaPosted Mar 10, 2015, 12:02 PM
1. do total and add to footer
int sumFooterValue = 0;
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
sumFooterValue += Convert.ToInt32(e.Row.Cells[1].Text );
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lbl = (Label)e.Row.FindControl("lblTotal");
lbl.Text = sumFooterValue.ToString();
}
}
2. Add Footer template to gridview for this you can also check msdn or google