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

NeedDataSource fires before PageIndexChanged event

2 Answers 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Smart
Top achievements
Rank 1
Smart asked on 25 Oct 2013, 04:13 PM
Hello All,
             I am trying to get the page index and then populate the radgrid with the corresponding page number. But, my NeedDataSource event fires before PageIndexChanged event, which defeats the purpose.  
The following link address the issue but, I cannot do the same.
http://www.telerik.com/community/forums/aspnet/grid/needdatasource-being-called-before-pageindexchanged.aspx

Here is my RadGrid Defination
<telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True"
AllowSorting="true" OnNeedDataSource="RadGrid1DataSource" skin="WebBlue"
AllowMultiRowSelection="true" EnableLinqExpressions="False" PageSize="25"
OnPageIndexChanged="RadGrid1_PageIndexChanged" DataSourcePersistenceMode ="ViewState"
EnableViewState="false">
 
    <mastertableview autogeneratecolumns="false" onneeddatasource="RadGrid1DataSource" autogeneratedeletecolumn="true" ShowFilterIcon="false" AllowMultiRowSelection="true">
             
        <columns>
                 
            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
            </telerik:GridClientSelectColumn>
       
 
     </columns>
 
     </mastertableview>
     <ClientSettings EnableRowHoverStyle="true">
            <Selecting AllowRowSelect="True" ></Selecting>
        </ClientSettings>
 
</telerik:RadGrid>
I hope there is some solution this problem. 

Thank you

2 Answers, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 30 Oct 2013, 12:55 PM
Hello Satish,

The described behavior is expected when the ViewState is disabled. The event sequence for the RadGrid is different when the EnableViewState property is set to true or false. The NeedDataSource event is fired before the paging command when the ViewState is disabled and after when it is enabled.

If you need more information on the event sequence for the RadGrid it is available in this article.

Note that the link you provided is to a thread regarding the RadControls Classic version which are no longer supported. It is recommended to use the latest version of RadControls.

Regards,
Viktor Tachev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Smart
Top achievements
Rank 1
answered on 31 Oct 2013, 01:56 PM
Thank you Viktor
Tags
Grid
Asked by
Smart
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Smart
Top achievements
Rank 1
Share this question
or