玄铁剑

成功的途径:抄,创造,研究,发明...
posts - 128, comments - 42, trackbacks - 0, articles - 174

custom GridView pager

Posted on 2008-03-27 22:44 玄铁剑 阅读(341) 评论(0)  编辑 收藏 引用 所属分类: ASP.NET相关

<PagerTemplate>
    <asp:Label ID="lblPage" runat="server" Text="Page:" ForeColor="blue"></asp:Label>
    <asp:Label ID="lblCurrentPage" runat="server" Font-Bold="true" Text="<%# ((GridView)Container.NamingContainer).PageIndex + 1 %>"
        ForeColor="red"></asp:Label>/
    <asp:Label ID="lblPageCount" runat="server" Font-Bold="true" Text="<%# ((GridView)Container.NamingContainer).PageCount %>"
        ForeColor="black"></asp:Label>       
    <asp:LinkButton ID="lbtnFirstPage" runat="server" CommandName="Page" CommandArgument="First" Text="First"
        Enabled="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>"></asp:LinkButton>
    <asp:LinkButton ID="lbtnPreviousPage" runat="server" Enabled="<%# ((GridView)Container.NamingContainer).PageIndex != 0 %>" Text="Prev"
        CommandName="Page" CommandArgument="Prev"></asp:LinkButton>
    <asp:LinkButton ID="lbtnNextPage" runat="server" CommandName="Page" CommandArgument="Next" Text="Next"
        Enabled="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>"></asp:LinkButton>
    <asp:LinkButton ID="lbtnLastPage" runat="server" CommandName="Page" CommandArgument="Last" Text="Last"
        Enabled="<%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>"></asp:LinkButton>       
</PagerTemplate>
<PagerStyle CssClass="GridPager"  HorizontalAlign="Center"/>

 

只有注册用户登录后才能发表评论。