Hey
you can add footer Template in the your
GridView (ItemGv).
<FooterTemplate>
<asp:Label ID="lblsum" runat="server"></asp:Label>
</FooterTemplate>
Also handle the
RowDataBound()
event for it.
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
decimal rTotal = Convert.ToDecimal
(DataBinder.Eval(e.Row.DataItem, "totaltb"));
grsum = grdTotal + rTotal ;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lblsum= (Label)e.Row.FindControl("lblsum");
lblsum.Text = grsum.ToString("c");
}
}