This article shows how to do paging in a GridView in ASP.NET using C#.
This article shows how to do paging in a GridView in ASP.NET using C#, where we take one GridView and SQL Server. We insert a large amount of data into the table to show how the paging works.INITIAL CHAMBERStep 1Open your Visual Studio 2010 and create an empty website, provide a suitable name such as gridview_paging_demo.Step 2In Solution Explorer you get your empty website, then add web forms and a SQL Server database as in the following.For Web Formgridview_paging_demo (your empty website). Right-click and select Add New Item -> Web Form. Name it gridview_paging_demo.aspx.For SQL Server databasegridview_paging_demo (your empty website). Right-click and select Add New Item -> SQL Server database. Add a database inside the App_Data_folder.DATABASE CHAMBERStep 3
In Server Explorer, click on your database (Database.mdf), then select Tables -> Add New Table. Form the table like the following:Table tbl_data (Don't forget to make the ID as IS Identity -- True)Figure 1: Tbl_DataDESIGN CHAMBERStep 4
Open the gridview_paging_demo.aspx file and write some code for the design of the application.
This is the GridView design and the properties window where you need to include the even–page changing index and page size = 4.Figure 2: PropertiesFigure 3: GridView Paging CODE CHAMBERStep 5
In the code chamber we will write some code so that our application works.gridview_paging_demo.aspx.cs
Programming C# for Beginners