Total output in the GridView footer row
//Global DeclarationDim units22 as Integer=0
Dim units2 as Integer=0
//Grid Events
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
units22 = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "Branches")) //Coloumn name
units2 = units22 + units2
End If
If e.Row.RowType = DataControlRowType.Footer Then
e.Row.Cells(6).Text = "Total"
e.Row.Cells(7).Text = units2.ToString().Trim()
e.Row.Font.Bold = True
End If
End Sub
Output:
Comments
Post a Comment