how to calculate sum of total in grid and display in label
how to calculate sum of total in grid and display in label
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.
Fathima JabbarPosted Mar 31, 2015, 7:48 AM
Hope the below given code snippet might help you
protected void Gridview1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (DataBinder.Eval(e.Row.DataItem, "COLUMNNAME") != DBNull.Value)
{
var_sum = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "COLUMNNAME"));
}
}
if (e.Row.RowType == DataControlRowType.Footer)
{
e.Row.Cells[2].Text = var_sum;
}
}
Pankaj Kumar ChoudharyPosted Mar 7, 2015, 11:23 AM
For better understanding your query