When trying to use the paging part of GridView in my application, I receive the following error:
The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.
When trying to use the paging part of GridView in my application, I receive the following error:
The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.
It means that the dataset associated with the gridview doesn't support paging.
It doesn't mean that you can't paged with it. To do that you will need to write your own code in PageIndexChanging event.
You need to add an eventhandler to tell the GridView which page it should be looking at as I'm guessing you have done the .DataBind() in code. An example would be:
Markup:
<asp:GridView ID="GridView1" runat="server"
EnablePagingAndSortingCallbacks="true"
OnPageIndexChanged="GridView1_PageIndexChanged" />
Code:
protected void GridView1_PageIndexChanged(object sender,
GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
GridView1.DataBind();
}
I mixed your answers and I get my answer. I solved this problem whit this code :
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
DataBind();
}