You need to create paging in GridView while creating websites in ASP.NET. It is a very simple process. In this article, I will show you the easiest way using which you can enable Paging in GridView while creating websites. Note that, the pager row, in which we display the number of pages and current page, which is used for quick navigation between pages, automatically hides itself when only one page is there.
- Create a new website or open an existing one in Visual Studio.
- Add a GridView control to one of the pages in the website.
- Select the GridView Control and open its properties. If properties window is not there, then you can open it by hitting shortcut key “Ctrl + W, P” or by going to “View” menu and then “Properties Window”.
- Change the value for AllowPaging from False to True. This property is set to False by default.
- Now Open its events window by clicking the lightening icon in the properties window.
- Now double click on the PageIndexChanging which will create a new method
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
- Add the following lines of code to that method
GridView1.PageIndex = e.NewPageIndex; GridView1.DataBind();
- Now, you will be having paging enabled in your GridView and working fine.
Incoming search terms:
- allow paging asp net gridview (1)
- how to add pagination to grid view (1)
- in paging databound serial number in gridview asp net (1)