Paging Using Sql Query In Gridview,Repeater

Paging Using Sql Query In Gridview, Repeater

How To Implement Paging Using Sql Query in asp.net application
Then First of all in your form Taking Two Button BtnNext and BtnPrevious.
Write Code in Button Click Next to Increment Hiddenfield value and Previous To Decrement Value.

SELECT Temp_id FROM TblTemp
WHERE Temp_id NOT IN
(SELECT TOP ((hiddenFieid - 1) * 15 ) Temp_id FROM TblTemp ORDER BY Temp_id ASC)
AND Temp_id NOT IN
(SELECT TOP ((hiddenFieid  * 15 ) Temp_id FROM TblTemp ORDER BY Temp_id ASC) ORDER BY Temp_id ASC


And also If you want to go Last Record then Totalrecords/ pagesize and Goes To First Record
Then Stop thinking write  hiddenFieid = 1 So Automatically Shown First 15 Records.

int PageSize = 15;
int hiddenFieid = Convert.ToInt32(Math.Floor(Convert.ToDouble((TotalRows / PageSize );