Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
Posted
Updated 21-Aug-12 4:42am
v2

Have a look on Persisting CheckBox State While Paging in GridView Control[^]
If you find this as useful mark as answer.
 
Share this 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.

SQL
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900