如何设置在GridView中显示的页码? [英] How to set the page numbers displayed in a GridView?
问题描述
我有一个寻呼机的GridView。 10页号(1 ... 10,11 ... 20等)的寻呼机显示块。
I have a gridview with a pager. The pager displays blocks of 10 page numbers (1...10, 11...20 etc.).
我试图实现的是,当用户点击一个页号,在该寻呼机的号码将重新调整,以使选定的页将在列表的中间。
例如:如果用户选择10页,在寻呼机号码将是:
What I'm trying to achieve is that when the user clicks on a page number, the numbers in the pager will re-align so that the selected page will be in the middle of the list. For example: If a user selects page 10, the numbers in the pager will be:
6 7 8 9 10 11 12 13 14 15
6 7 8 9 10 11 12 13 14 15
目前,它显示:
1 2 3 4 5 6 7 8 9 10 ...
1 2 3 4 5 6 7 8 9 10 ...
和为用户达到11页的唯一方法是点击3个点(...)。
And the only way for the user to reach page 11 is to click on the 3 dots (...).
那怎么可以实现?
谢谢!
推荐答案
下面是一篇文章,解释了如何自定义GridView的页面,的 http://kikosantos.net/tech/2006/05/custom-paging-in-gridview-control/ 。从这里,你应该能够自定义分页模板,使你的愿望的变化。
Here is an article explaining how you can customize the gridview's page, http://kikosantos.net/tech/2006/05/custom-paging-in-gridview-control/. From here, you should be able to customize the paging template to make the changes you desire.
自定义分页的另一个例子:<一href=\"http://dotnetslackers.com/articles/gridview/Custom-GridView-with-Paging-and-Filtering.aspxhttp://dotnetslackers.com/articles/gridview/Custom-GridView-with-Paging-and-Filtering.aspx\" rel=\"nofollow\">http://dotnetslackers.com/articles/gridview/Custom-GridView-with-Paging-and-Filtering.aspxhttp://dotnetslackers.com/articles/gridview/Custom-GridView-with-Paging-and-Filtering.aspx
Another example of custom paging: http://dotnetslackers.com/articles/gridview/Custom-GridView-with-Paging-and-Filtering.aspxhttp://dotnetslackers.com/articles/gridview/Custom-GridView-with-Paging-and-Filtering.aspx
还有一: http://www.dotnetcurry.com/ShowArticle.aspx? ID = 339
这篇关于如何设置在GridView中显示的页码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!