tags:

views:

87

answers:

2

I am using Paging on a GridView that is tied to a List. But i use this code, it does not work. What is the correct way. i am not using objectdatasrc

protected void myGV_PageIndexChanging(object sender, GridViewPageEventArgs e) {

    List<Employee> p = ReturnEmplColl();
    GridView1.DataSource = p.Paging(1, e.NewPageIndex);
    GridView1.DataBind();

}

A: 

Try this:

protected void myGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {

        List<Employee> p = ReturnEmplColl();
        GridView1.DataSource = p;
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
    }
Kb
A: 

I solved it. did it like this

GridView1.PageIndex = e.NewPageIndex; GridView1.DataSource = ReturnEmplColl();