Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I enable the paging property of a DataGrid control in ASP.NET 3.5 with AJAX 3.0? I am getting the following error when I try to do it:

The GridView 'GridView1' fired event PageIndexChanging which wasn't handled.


Can anyone help me out please?
Posted
Updated 19-Feb-10 11:26am
v2

1 solution

Are you doing this in VB or C#? It helps if you are more specific.

Ok first things first. The datagrid and the gridview are different controls. Imagine the gridview as a datagrid on steroids.

Also, this doesn't really have anything to do with ajax. Yes the gridview control uses javascript but you don't need to worry about that.

If it is a gridview you are using (which I recommend)then it's as easy as this.....

In vb

VB
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As GridViewPageEventArgs) _
Handles GridView1.PageIndexChanging
    GridView1.PageIndex = e.NewPageIndex
    ''Rebind the gridview to the datasource.
End Sub


In c#

C#
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    //Rebind the gridview to the datasource.
}


That should do it.

Obviously in c# you will have to add the handler to your gridview control. You can either do this by clicking on the event in your properties tab or manually change it in your designer file.

Good luck.
 
Share this answer
 

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