The GridView fired event PageIndexChanging which wasn’t handled
By Jamsi • Oct 22nd, 2008 • Category: ASP.NETIf you’ve set a gridviews AllowPaging attribute to “true”, you’ll notice the following error;
The GridView fired event PageIndexChanging which wasn’t handled
To setup paging with Gridviews, you also need to set the page index property to the new page that you wish to view. Funny enough, this is extremely easy to do. See below for a code example written in C#.
The ASPX page
1 | <asp:GridView ID="gvList" runat="server" AutoGenerateColumns="true" AllowPaging="true" PageSize="10" OnPageIndexChanging="gvList_PageIndexChanging"> |
and the C# code
1 2 3 4 5 6 7 | protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e) { bindGrid(); gvList.PageIndex = e.NewPageIndex; gvList.DataBind(); } |
No related posts.
FREE NEWSLETTER -> Want Tech Tips Sent Straight to your Inbox?
Grab our Newsletter to Ensure your PC is Running Smooth!
Jamsi is currently studying a full time Bachelor of Computer/Business degree and working part time as an Internet Security Consultant.
Email this author | All posts by Jamsi
























Hey dude..Thanks …helped a lot…