How to make paging for grid in asp.net

How to make paging for grid in asp.net
first take PageIndexChanging event and paste this code
-------------------------------------------------------------------------------------------------

protected void Gridalldisplay_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
Gridalldisplay.PageIndex = e.NewPageIndex;
grid();
}
............................................................................................................................................................................
public void grid() //function for populating grid
{
dt = obj.call("Select * from table_name");
if (dt.Rows.Count > 0)
Gridalldisplay.DataSource = dt;
Gridalldisplay.DataBind();
}
-------------------------------------------------------------------------------------------------

1 comment:

Anuraj S said...

myclass obj=new myclass
obj means object for a classs
call is a function for reading data