Home DotNet Gridview PageIndexChanging
09.09.2010
Main Menu
Programming
.NET Controls
Operating System
Databases
Articles
Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: StumbleUpon Add to: Slashdot Add to: Yahoo Add to: Technorati Add to: Google
Gridview PageIndexChanging

You have enabled the gridview property allowpaging to true and when you run the page you get an error similar to the below:

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

The reason you are getting this error is because you need to set the OnPageIndexChanging event. This event is raised whenever you click on the page number. In the event method you can peforms your custom routine code such as canceling the paging operation.

On the ASPX file make sure you have enable the OnPageIndexChanging event.

In the asp 
        <
asp:GridView ID="gvResult" runat="server" AutoGenerateColumns="false" Width="700"

                            OnPageIndexChanging="gvResult_PageIndexChanging" AllowPaging="true" PageSize="2">

 

On the class make sure you have the following method.

        protected void gvResult_PageIndexChanging(object sender, GridViewPageEventArgs e)

        {

            gridView.PageIndex = e.NewPageIndex;

            gridView.DataBind();

        }



Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."