使用链接按钮自定义分页 [英] Custom Paging With Link Buttons

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

问题描述

大家好,
我已经从存储过程中获取了数据集,并且成功了.但是现在我想在列表视图或任何其他数据控件下面使用自定义分页.我使用了10个linkbutton并尝试创建自定义分页,但全部都是徒劳的,因为必须同时有一个prev和next按钮,并且我如何才能控制根据页面可见的多少linkbutton我有页面总数变量,也有行总数,但是我在下一个或上一个按钮或开始中失败了,例如如果我只有3页,那么如何仅显示3个linkbutton和其他linkbutton必须是不可见的.我完全感到困惑,浪费了很多我的时间.因此,请任何帮助都是非常紧急的.我很高兴有一个像codeproject这样的网站对我非常有帮助.

Hi all,
I have fetched dataset from stored procedure and it''s success. But now I want to use custom paging below the listview or any other data control. I used 10 linkbuttons and tried to create custom paging but all in vain because there must be one prev and next button also and how can i contorl that how many linkbuttons visible according to pages i have total pages variable and also i have total rows but i am failed in next or prev buttons or in starting like if i have only 3 pages then how can display just 3 linkbuttons and other linkbuttons must be invisible. I am confused totally and wasted lots of mine time. So please any help is very urgent. It is my pleasure to have a website like codeproject that is very helpful to me.

推荐答案

我不会给您代码,但是我会尽力帮助您组织与分页有关的思考过程,以便您可以自己开始进行操作.

让我们从您所知道的开始:

I wont give you code, but I''ll try to assist you in organizing the thought process involved with paging so you can start woking it out yourself.

Let''s start with what you know:


  1. TotalNumberOfRows:结果集中的总行数.
  2. NumberOfRowsPerPage:每页要显示的行数/记录数.
  3. :将从1.和2.用1.除以2的整数除法计算得出.如果1.除2.的模数大于零,则将TotalNumberOfPages加1.
  4. CurrentPageNumber :当前显示页面的编号.分页开始时,它将初始化为一(1).

  1. TotalNumberOfRows: The total number of rows in your result set.
  2. NumberOfRowsPerPage: The number of rows/records you want to display per page.
  3. TotalNumberOfPages: This will be calculated from 1. and 2. by an integer division of 1. by 2. If the modulo of 1. by 2. is greater than zero increase TotalNumberOfPages by one.
  4. CurrentPageNumber: The number of the currently displayed page. When paging starts this will be initialized to one (1).



使用哪种逻辑实际上取决于上一个和下一个按钮的语义.

仅仅是一页的进步吗?
还是您要显示下一组可用的页面.例如:
一共有10页,一组显示5个,如下所示.

上一个 1 2 3 4 5下一个

按next会显示以下内容:

上一个6 7 8 9 10 下一个

最好的问候,

—MRB



What logic to use really depends on what the sematics of the previous and next buttons are.

Is it just an advancement of one page?
Or did you mean to display the next available set of pages. E.g.:
There are ten pages and in a set 5 are displayed like below.

previous 1 2 3 4 5 next

Does pressing next show this:

previous 6 7 8 9 10 next

Best Regards,

—MRB


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

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