Click here to Skip to main content
15,908,274 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i set pagination in ASP.NET gridview
Posted
Updated 12-Oct-11 23:34pm
v2

 
Share this answer
 
v3
 
Share this answer
 
gridview in asp.net alredy has proprty of paging.
set AllowPaging=true;
and you can set PagerSettings from properties.
 
Share this answer
 
v2
Set the
Griidview AllowPaging="true" 

and
pagesize="20"

In page index changing event write the following code



C#
protected void Gridview1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
           
            gvEMaterials.PageIndex = e.NewPageIndex;
            FillGrid();//Method to bind gridview
    }


or check this

Showing a page of information at a time in a GridView[^]
 
Share this answer
 
v3
Set the Gridview's properties AllowPaging="true" and pagesize="20"
 
Share this answer
 
set gridview property AllowPaging="true" ;

In page index changing event write the following code
C#
protected void gvEMaterials_PageIndexChanging(object sender, GridViewPageEventArgs e)
       {
            gvEMaterials.PageIndex = e.NewPageIndex;
            FillGrid();//method to bind grid
        }
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900