i have to add the total no of present in grid view using asp.net
eg
id name status
1 s Present
1 s Present
1 s Present
total 3
i need to show the present days as total
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.
Abhishek KumarPosted May 16, 2014, 8:06 AM
you can try below code
Its not full code but a it will solve your problem.
RowDataBound event of grid put the below code and you can display total presents in footer.
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label Attendance = (Label)e.Row.FindControl("lblAttdence");
decimal Presents = Convert.ToDecimal(Attendance.tostring());
total += Presents;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lblTotalAttendance = (Label)e.Row.FindControl("lblTotal");
lblTotal.Text = total.ToString();
}
Hope this will help.
Thanks.