If 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
<asp:GridView ID="gvList" runat="server" AutoGenerateColumns="true" AllowPaging="true" PageSize="10" OnPageIndexChanging="gvList_PageIndexChanging">
and the C# code
protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
bindGrid();
gvList.PageIndex = e.NewPageIndex;
gvList.DataBind();
}
No related posts.
Hey dude..Thanks …helped a lot…
thank you so much
exactly what I’am looking for, great!
In my case, after adding those codes, the same exception will not be triggered, but all the other pages will not be displayed except the very first page. It is a total blank after I clicking page 2 or 3, or 4, 5 ….
Thanks a lot. It worked for me!
Thanks for the help, much appreciated!
This is the problem and this is the exact solution for this type of exception
I have tried the code supplied, but my code does not recognise bindGrid() as being in the current context.
What am I missing?
tnx very very very much,ure site is the best,tnx
Thank Q u
very nice its very useful
Aparently that fix does not work for everyone.
I have been trying to make grid view paging work on 2 different computers. One with Vista and VWD 2008 and one with XP and visual studio 2008.
I get the unhandled event error when clicking on the page number if I dont put code in the handler. If I put the code in the handler, my gridview disapears from the web page.
Great..Helped a lot..
Thanks
Thanks a lot buddy, but the ultimate credit goes to supradipda for helping me to learn the fundamentals and how to search problems on net
Thanks a lot, your steps helped me in making grid work.
Thanks for the post, this was my first grid. After trying several examples this worked great!!!!
Thanks alot…
Thanks alot…
Awesome dude. You saved me a day.. Rocks !
Thank u very much!
thanks a lot……….
Great work …Thanks a lot…
Great Work It helped me lot
Thanks a lot it worked.
the error is gone but on page second nothing is displaying.
I have tried the code supplied, but my code does not recognise bindGrid() as being in the current context.
Thanks alot, works well
Thanks a lot for short explanation, but really help me…
Thanks…it works now!
thanks
The article is worth reading,Thank you very much! I will keep your new articles.
In my case, after adding those codes, the same exception will not be triggered, but all the other pages will not be displayed except the very first page. It is a total blank after I clicking page 2 or 3.
now what am doing,please help me