29 March 2013

Paging in GridView using ObjectDataSource

One sunny morning, we're developing a small project when my trainee asked me how to add Paging in the GridView using ObjectDataSource:

I showed him a simple solution. I simply set the AllowPaging to true (GV) then add the following script from code behind:

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        FillGrid();
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
    }


No comments:

Post a Comment