Hi yara,
Add the below code in row databound event and change the footerstyle forecolor to display the record.
C#
decimal amount = 0;
protected void OnDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
amount += Convert.ToDecimal((e.Row.FindControl("Label3") as Label).Text);
}
if (e.Row.RowType == DataControlRowType.Footer)
{
(e.Row.FindControl("lblAmount") as Label).Text = amount.ToString();
}
}
VB.Net
Private amount As Decimal = 0
Protected Sub OnDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
amount += Convert.ToDecimal(TryCast(e.Row.FindControl("Label3"), Label).Text)
End If
If e.Row.RowType = DataControlRowType.Footer Then
TryCast(e.Row.FindControl("lblAmount"), Label).Text = amount.ToString()
End If
End Sub
You can refer below link also.
https://msdn.microsoft.com/en-us/library/bb310552.aspx