如何在ASP.NET中动态创建的gridview中添加带标签的页脚

如何在ASP.NET中动态创建的gridview中添加带标签的页脚

问题描述:

实际上我创建了网格dyanamically所有列都来自数据库。现在我想在页脚实验中显示列值的总和



我尝试了什么:



actually i created grid dyanamically all clumns are came from database .now i want to display sum of column values in footer labes

What I have tried:

<asp:GridView ID="AIGrid" runat="server"

                                                      AutoGenerateColumns="False" PageSize="25"

                       AllowPaging="true" OnPageIndexChanging="OnAIGrid_PageIndexChanging" ShowFooter="true"  OnRowCreated ="AIGrid_RowCreated"

                   Font-Size="10pt" CssClass="grid" OnRowDataBound="AIGrid_RowDataBound">
                   <Columns>

                   </Columns>
                   </asp:GridView>



this是我的aspx页面,我的cs页面代码在下面




this is my aspx page and my cs page code is in below

if (e.Row.RowType == DataControlRowType.Footer)
        {
            GridViewRow Footerrow = new GridViewRow(1, 0, DataControlRowType.Footer, DataControlRowState.Insert);
            Label  txtCountry = new Label();
        }

检查这个

使用ASP.Net中的GridView页脚中的总列数显示总和C#和VB.Net [ ^ ]

在页脚显示总和 [ ^ ]
check this
Display sum of Columns total in GridView Footer in ASP.Net using C# and VB.Net[^]
display sum at footer[^]