Gridview分页模板
通過<PagerTemplate>……</PagerTemplate>來實現分頁。代碼如下:
<PagerTemplate>
????????? <div id="pageindex" align="right">
??????????? 第<asp:Label? ID="LabelCurrentPage" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"></asp:Label>頁
??????????? 共<asp:Label ID="LabelPageCount" runat="server" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"></asp:Label>頁
??????????? <asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page"
???????????? Visible="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">返回首頁</asp:LinkButton>
??????????? <asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page"
???????????? Visible="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一頁</asp:LinkButton>
??????????? <asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"
???????????? Visible="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一頁</asp:LinkButton>
??????????? <asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page"
???????????? Visible="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">最后一頁</asp:LinkButton>
????????? </div>
??????? </PagerTemplate>
轉載于:https://www.cnblogs.com/kerry1986/archive/2009/09/04/1560142.html
總結
以上是生活随笔為你收集整理的Gridview分页模板的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单点登陆的ASP.NET应用程序设计[z
- 下一篇: 做到这23条,你就成熟了!