This is a migrated thread and some comments may be shown as answers.

OnPageIndexChanged does not always fire on next/prev buttons

4 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 06 Feb 2008, 08:42 AM
I have a very strange problem with my grid which I just cannot see the answer to.  When my grid first loads, I click the 'Next' page button and the grid correctly raises the OnPageIndexChanged event and moves to the next page.  I then click it again and the event does not fire and the grid returns to page index 0.  On the first click the following events are raised:

NeedDataSource
OnPageIndexChanged
NeedDataSource

On the second click, I only get:

NeedDataSource

I am aiming to replicate the solution provided in this forum thread.

My grid definition is as follows.  Can anybody see why this would happen?

        <telerik:RadGrid runat="server" ID="EntitiesGrid" 
            OnNeedDataSource="EntitiesGrid_NeedDataSource" OnPageIndexChanged="EntitiesGrid_PageIndexChanged" 
            Width="100%" Height="300" GridLines="None" AllowPaging="true" 
            OnItemDataBound="EntitiesGrid_ItemDataBound" ShowHeader="false"   
            AllowMultiRowSelection="true" BorderWidth="0" Skin="Vista" EnableViewState="false">  
            <PagerStyle Mode="NextPrevAndNumeric" /> 
            <MasterTableView TableLayout="Fixed" AutoGenerateColumns="false" BorderWidth="0" onmousedown="ShowContextMenu()">  
                <Columns> 
                    <telerik:GridTemplateColumn UniqueName="ImageColumn" ItemStyle-Width="35"></telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="NameColumn"></telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="DrillDownColumn" ItemStyle-Width="25"></telerik:GridTemplateColumn> 
                </Columns> 
            </MasterTableView> 
            <ClientSettings  ApplyStylesOnClient="true">  
                <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
                <Selecting AllowRowSelect="true" EnableDragToSelectRows="false" /> 
                <ClientEvents OnRowSelected="GridRowSelected" OnRowDeselected="GridRowDeselected" OnTableCreated="Resize" OnMasterTableViewCreated="Resize" /> 
                <Resizing EnableRealTimeResize="true" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
 

I should also add that with NextPrevAndNumeric paging mode, selecting the page numbers works as expected every time.

Thanks in advance.

4 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 11 Feb 2008, 08:04 AM
Hi Jonathan,

Based on the information supplied I suspect that this may be a databinding issue. However, in order to be sure, it would be best if you open a formal support ticket, and send us the problematic implementation, for  further review. We will test it locally, and get back to you with our findings.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jonathan
Top achievements
Rank 1
answered on 19 Feb 2008, 10:43 AM
Hi,

Apologies for the long delay in replying.  I have finally got round to creating a test project for you based on my code and in that the pager works perfectly, so it is definitely something I am doing.  Unfortunately, until I can replicate it in a new project, I cant package it up to send to you.  Hopefully I will be able to sort this one out myself.

Thanks.
0
Sebastian
Telerik team
answered on 19 Feb 2008, 11:34 AM
Hi Jonathan,

Feel free to post the example (replicating the issue) attached to a formal support ticket once you assemble it. We will review it locally and will advice you further.

Best regards,
Stephen
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jonathan
Top achievements
Rank 1
answered on 22 Feb 2008, 10:00 AM
Hi,

I finally got to the bottom of this issue and it was my code which was causing the issue. I have a BasePage class which overrided the standard System.Web.UI.Page class and adds new methods and properties I require on all my pages.  I had code running in an overridden OnInit function in this class which caused an issue with postbacks on RadGrid.  I dont know why but moving it to OnLoad solved the issue!

Thanks.
Tags
Grid
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Jonathan
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or