2017-03-21 7 views
0

におけるサマリーフッターを取得します。Asp.netは、私は、グリッドビューコントロールを持つグリッドビューコントロール

<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> 

背後にあるコード:

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 

出力:

GridViewOutput

を次に、このような残高の要約を含むフッターを追加します:

enter image description here

ありがとうございます!列ごとにフッターテンプレートについて
http://www.c-sharpcorner.com/UploadFile/satyapriyanayak/dsfsdf/

答えて

2

あなたはこれを達成することができ、このソリューションを参照してくださいASP.NET gridview footer template

+0

取得するために新しい列を追加アプローチ:

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") 


この例を参照してください。合計残高、他の残高と同じ列に総サマリー残高を入れることが可能かどうかを確認したい。 – pepe

+0

各列のフッターの回答を更新しました。 – Rajendra

+0

あなたのお手伝いをしていただきありがとうございます! – pepe

関連する問題