zoukankan      html  css  js  c++  java
  • 一个GridView的PagerTemplate

    2007年03月29日 星期四 17:31

    <PagerTemplate>
    <div style="text-align: right;">
          <asp:LinkButton ID="cmdFirstPage" runat="server" CommandName="Page" CommandArgument="First"
           Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>">首页</asp:LinkButton>
          <asp:LinkButton ID="cmdPreview" runat="server" CommandArgument="Prev" CommandName="Page"
           Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=0 %>">前页</asp:LinkButton>
          第<asp:Label ID="lblcurPage" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1      %>'></asp:Label>页/共<asp:Label
           ID="lblPageCount" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageCount %>'></asp:Label>页
          <asp:LinkButton ID="cmdNext" runat="server" CommandName="Page" CommandArgument="Next"
           Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">后页</asp:LinkButton>
          <asp:LinkButton ID="cmdLastPage" runat="server" CommandArgument="Last" CommandName="Page"
           Enabled="<%# ((GridView)Container.Parent.Parent).PageIndex!=((GridView)Container.Parent.Parent).PageCount-1 %>">尾页</asp:LinkButton>
          转<asp:TextBox ID="txtGoPage" runat="server" Text='<%# ((GridView)Container.Parent.Parent).PageIndex+1 %>'
           Width="32px" OnTextChanged="txtGoPage_TextChanged" CssClass="inputmini"></asp:TextBox>页</div>
    </PagerTemplate>

    需要两个方法配合:

    txtGoPage_TextChanged
    gridresult_PageIndexChanging

    protected void txtGoPage_TextChanged(object sender, EventArgs e)
            {
           GridView1.PageIndex =Convert.ToInt32(((TextBox)sender).Text) - 1;
              
                GetData();
            }

  • 相关阅读:
    查看执行SQL效果,消耗资源的SQL查看命令
    网页上搜索apk链接工具
    PL/SQL 获取一个月的天数排除周六周日
    java 数字转换
    jQuery选择器
    Oracle 10g 透明网关 sql server2005 配置
    怎么进行软件测试才能把bug降到最低呢??
    Demon推荐的Blog和网站
    基于.NET的俄罗斯方块课程设计
    【读书笔记】《锋利jQuery》第一章
  • 原文地址:https://www.cnblogs.com/smallfa/p/1361746.html
Copyright © 2011-2022 走看看