如何获取ID的gridview中的“首个",“下一个"按钮. [英] How to get ID's for First,Next buttons in gridview.

查看:71
本文介绍了如何获取ID的gridview中的“首个",“下一个"按钮.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

http://www.dotnetfunda.com/article/article509-paging-for-first-next-previous-and-last-in-gridview.aspx [ 我的疑问是,我总是只会得到任何10条记录ID的
即1-10(或11-20).我想获取所有1-20记录ID.
现在,如果我单击第一个"按钮,则已检查的记录(即(1-10)个ID中的记录)将丢失.
如何获取所有(1-20)ID的第一和第二个我检查的下一个按钮???

请给我解决方案....

预先感谢,
VenkateshDesai.

Hi All,

http://www.dotnetfunda.com/articles/article509-paging-for-first-next-previous-and-last-in-gridview.aspx[^]

As the refference of the above link I got one doubt…

Totally I am having 30 records in my database.
I am giving page size as 10.so first 10 records are been placed on page load.
Now I want to get ID’s.I will get ID’s through checkbox i.e., from (1-10) upto here no doubt.
Now I click on Next button according to the above link so next 10 records will appear i.e., (11-20)ID’s will get by the check box.
Here my doubt is that I am getting always only any 10 record ID’s
i.e., either 1-10 (or) 11-20.i want to get all 1-20 record ID’s.
Now if I click on First button the checked records i.e., from (1-10) ID’s are lost.
How to get all (1-20) ID’s both First & Next Buttons I checked????

Please give the solution to me….

Thanks in advance,
VenkateshDesai.

推荐答案

看看在分页时保持复选框状态在GridView控件中 [^ ]
如果您觉得这对回答很有用.
Have a look on Persisting CheckBox State While Paging in GridView Control[^]
If you find this as useful mark as answer.


亲爱的,
如果您想使用服装分页来检索数据(意味着从数据库中检索一些记录集而不是整个记录),那么我正在提供一个必须帮助您的过程.然后,您可以使用逻辑来确定要在页面上显示多少记录以及如何显示.

Dear,
If you want to retrieve the data with costume paging(means retrieve some set of records instead of whole records from database), then i am providing a procedure which must help you. Then you can use your logic for how much records you want to show on your page and how.

CREATE PROCEDURE GETDATA
(
@StartRowIndex INT,
@MaxmumRows INT
)
AS BEGIN
SET @StartRowIndex = (@StartRowIndex * @MaxmumRows)
SELECT * FROM
(
SELECT *, ROW_NUMBER() OVER(ORDER BY ID DESC) AS RowRank FROM MyTable
) AS MyTable WHERE RowRank > @StartRowIndex AND RowRank <= (@StartRowIndex + @MaxmumRows)
END


这篇关于如何获取ID的gridview中的“首个",“下一个"按钮.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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