How to perform implement in a GridView in ASP.Net

In this tutorial we will learn how to perform or implement simple Pagination in a gridview with C# and VB.Net code example step by step.

To perform paging in a gridview we need to minimum set it 2 property and handle one event.

All you need is to set Griview Pagesize Property to any integer value let's say 10 and AllowPaging = true.

Also, you need to handle onpageindexchanging of GridView in your code file .cs or .vb page

So your GridView html code looks like this. In this my Gridview id is GridView1<asp:GridViewID="GridView1"runat="server"PageSize="10"AllowPaging="true"onpageindexchanging="GridView1_PageIndexChanging">

</asp:GridView>

In below code I am creating a DataTable and bind it to my Gridview so that we can see some data in our gridview