.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Lee Hnetinka

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

ASP.NET - Grid View and List View with Paging

Posted By: Shravya     Posted Date: September 26, 2009    Points:2   Category :ASP.Net

We are working on Grid View and List View controls in an ASP.NET application. To provide better performance we planned to provide pagination with 10 records display, at a time. We does not want to get all the records from database (at a time) and bind them to these controls i.e. we need to get only 10 records at a time from database and bind them but we need to implement pagination.

Kindly let me know if you know any code samples to achieve this functionality.

Thank you.

Author: Akhil Raj       [Moderator]      
Posted Date: September 28, 2009     Points: 5   

hi ,
I didnt git clearly friend. If you want only 10 or restricted data then you can use filter. After if you need also can apply paging.

Author: Selvaraj Prabhu             
Posted Date: September 30, 2009     Points: 5   

hi this is very easy. Two methos we can do paging
1.By using Datasource
2.Without DataSource

1.RightClick On GridView Select Show Smart Tag -> Select DataSource->Proceed with ur database connection->Test the Connection-> Next->Selct the Table which u have to diaplay->Follow the procedure........Finish. Again Go for the Smart tag prpoerties enable paging True by CheckBox. Now u can Do the Paging like this.


gvdPatientDetails.PageIndex = e.NewPageIndex;
gvdPatientDetails.DataSource = dt;

Author: Nabin             
Posted Date: October 04, 2009     Points: 5   

dear shravya

pagging option is already inbuilt in gridview control in asp.net. so u dont need to write extra code for that u just have to implement that option.
for that u just have to change the index of gridview as allowpagging=true.

and also in c# page in selected index change event just write:-
gridname.pageindex= e.newpageindex;

try this


Author: Rahul             
Posted Date: October 18, 2009     Points: 5   

You can use your stored procedure like this and you need to pass the input parameter of the desired page

CREATE PROCEDURE [dbo].[SPNAME_Select](@Page int)


DECLARE @StartPage int
DECLARE @EndPage int

SET @StartPage = @Page * 10
SET @EndPage = @StartPage + 10



SELECT ROW_NUMBER() OVER (ORDER BY Table_Name.[Column_Name]) AS RowNumber,COl1,Col2,Col3
FROM Table_Name


AS MyTable
WHERE MyTable.RowNumber BETWEEN @StartPage AND @EndPage order by posted_date desc



Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend