如何使用gridview进行自定义分页 [英] How can I make a custom paging with gridview

查看:59
本文介绍了如何使用gridview进行自定义分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!



我正在使用gridview制作电路板,但我有一个问题。



我想做一个分页,我只使用Grid View基本分页....来自数据库(sql)



我想做的就像这样



<< < 1 2 3 4 5> >>



<<是第一个,<是之前的,1 2 3 4 5是数字,5是最大数字数



和>接下来是>>是最后的



现在我正在从互联网上搜索这个...我很困惑如何使用它......



所以请...有人告诉我正确的方法......



我尝试了什么:



只能在这样的基本分页中使用

- Html代码 -

Hello!

I`m making a Board using gridview, but I have one problem.

I want to make a paging, and I only using Grid View basic paging.... from database(sql)

What I want to do is like this

<< < 1 2 3 4 5 > >>

<< is first, < is previous, 1 2 3 4 5 is numeric and 5 is max numeric count

and > is next, >> is last

Now I`m searching about this from the Internet.. I`m confusing how to use it....

So Please... somebody show me the right way to make it...

What I have tried:

Only using in basic paging like this
-- Html Code --

<asp:GridView ID="GridView1"

                 runat="server" 

                 CellPadding="4" 

                 ForeColor="#333333" 

                 GridLines="None" 

                 Width="862px" 

                 RowStyle-HorizontalAlign="Center" 

                 AutoGenerateColumns="False"    

                 DataKeyNames="BoardItemID" 

                 AllowPaging="True" 

                 PageSize="5" 

                 OnPageIndexChanging="GridView1_PageIndexChanging" 

                 ShowHeaderWhenEmpty="true" 

                 EmptyDataText="Data not found.">



- 代码背后 -


-- Code Behind --

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    PutGridView();
}

推荐答案

检查我的其他类似解决方案,它可以帮助您指导正确的方向。



(忽略代码的复制数据部分,查看代码示例底部附近的分页逻辑)。



< a href =http://www.codeproject.com/Answers/1117312/How-to-store-specific-rows-from-one-dataset-to-ano#answer1>如何将特定行从一个数据集存储到另一个。 [ ^ ]
Check my other similar solution it may help you guide to the right direction.

(Ignore the copying data part of the code, look at near the bottom of code sample for paging logic).

How to store specific rows from one dataset to another.[^]


这篇关于如何使用gridview进行自定义分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆