【问题标题】:Numerical paging for GridViewGridView 的数值分页
【发布时间】:2012-06-11 05:19:41
【问题描述】:

我正在使用 GridView 来显示数据库中的数据。将 ASP.Net 4.0 与 C# 一起使用。 GV 被赋予 DataTable 作为其数据源。我需要在此网格中显示数字分页,用户可以在其中看到“下一个”和“上一个”按钮以及“页码链接”,例如

>

在网格的右上角。有没有办法使用自定义分页或 GV 的任何内置功能来做到这一点?我需要为页码点击处理什么样的事件?任何人都可以请我指出正确的方向或代码 sn-p 吗?

谢谢...

【问题讨论】:

    标签: asp.net gridview custompaging


    【解决方案1】:
     `allowpaging="true"` in gridview
    

    然后写你pagersettings

    <pagersettings mode="NumericFirstLast"
                firstpagetext="First"
                lastpagetext="Last"
                pagebuttoncount="5"  
                position="Bottom"/> 
    

    you can see detail here

    (可选)在服务器端

    将您的页面更改逻辑放在PageIndexChanged

    【讨论】:

      【解决方案2】:
      1. 将 AllowPaging 属性设置为 true。

      2. 设置 GridView.PagerSettings.Mode = PagerButtons.NumericFirstLast

      3. 设置 position="Top" 并将以下内容添加到标记中

        <PagerStyle HorizontalAlign="Right" /> 
        
      4. 附加到 PageIndexChanged 事件以处理页面数字点击

      Here is good example.

      您可以在此处找到更多详细信息: http://msdn.microsoft.com/en-us/library/5aw1xfh3.aspx

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-09-16
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多