I have a grid view control:
<asp:GridView ID="grdView" runat ="server" AutoGenerateColumns ="false" >
<Columns>
<asp:BoundField DataField ="Id" HeaderText ="Agreement ID"/>
<asp:BoundField DataField ="Balance" HeaderText ="Balance" />
</Columns>
</asp:GridView>
The code behind:
Private Sub form1_Load(sender As Object, e As EventArgs) Handles form1.Load
Dim agreementManager As AgreementManager = New AgreementManager()
Dim lstAgr As List(Of Agreement) = agreementManager.GetAll()
grdView.DataSource = lstAgr
grdView.DataBind()
End Sub
The output:
Then, I want to add a footer with the summary of balance like this:
Any Idea?
Thanks in advance!!
You can achieve this, refer this solution :
http://www.c-sharpcorner.com/UploadFile/satyapriyanayak/dsfsdf/
For footer template for each column :
Dim total As Decimal = dt.AsEnumerable().Sum(Function(row) row.Field(Of Decimal)("Balance"))
grdView.FooterRow.Cells(0).Text = "Balance"
grdView.FooterRow.Cells(0).HorizontalAlign = HorizontalAlign.Right
grdView.FooterRow.Cells(1).Text = total.ToString("Balance")
refer this example : ASP.NET gridview footer template