【问题标题】:GridView how to show Footer when gridview is emptyGridView如何在gridview为空时显示Footer
【发布时间】:2014-11-08 07:25:44
【问题描述】:

我有一个网格视图,我在其中添加、更新数据。要添加数据,我使用了页脚模板。在页面加载网格视图数据源为空,因此它不显示页脚 - 有页眉的属性

ShowHeaderWhenEmpty="True"

但我没有找到添加页脚的属性。 网格视图为空时如何显示页脚?

【问题讨论】:

  • 你想在页脚显示什么??图片??文字??
  • 添加新行的控件

标签: c# asp.net gridview


【解决方案1】:

试试这样的:

<asp:GridView ID="gvCustomers" runat="server" Width="550px"
AutoGenerateColumns="false"
Font-Names="Arial" Font-Size="11pt" AlternatingRowStyle-BackColor="#C2D69B"
HeaderStyle-BackColor="green"
AllowPaging="true" ShowFooter="true" OnPageIndexChanging="OnPaging" PageSize="10">
<Columns>
    <asp:BoundField HeaderText="CustomerID" DataField="CustomerId" FooterText="Footer" />
    <asp:BoundField HeaderText="Contact Name" DataField="ContactName" FooterText="Footer" />
    <asp:BoundField HeaderText="Company Name" DataField="CompanyName" FooterText="Footer" />
</Columns>
<AlternatingRowStyle BackColor="#C2D69B" />
</asp:GridView>

参考:http://www.aspsnippets.com/Articles/Display-GridView-with-Empty-Message-and-Header-and-Footer-when-no-data-in-ASP.Net.aspx

【讨论】:

  • 希望对您有所帮助!
  • @Krupa Patel 链接的文章的 TLDR 是,为了有一个页脚,当 gridview 有行到您的空数据模板时,您必须复制页脚模板的 HTML。
猜你喜欢
  • 1970-01-01
  • 2015-07-09
  • 2013-12-10
  • 2013-12-16
  • 2018-05-31
  • 2011-03-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多