RadGrid loses sort and page index after postback

2 posts, 0 answers
  1. Jan
    Jan avatar
    1 posts
    Member since:
    Dec 2015

    Posted 06 Apr Link to this post

    Hello,

    we have updated one of our solutions from .NET 3.5 to 4.0 with a new Telerik version. Right now we are having an critical issue we are not able to solve.

    We are opening an selection form in an modal dialog. All available items are displayed in an GridView where the user can select a single item. On post back the form is handing the user selection back to the previous form. From the theory quite easy going. Right now we have recognized an ciritical issue with our post back.

    On postback we are loosing the ViewState and the ControlState of the GridView. Due to this case, it will reload the data source, without the selected sort, filter and page options and returns the wrong user selection.

    For example:

    If we select the 3rd item on page 2, while all items are sorted alphabetically ascending, it will return the 3rd item from the datasource, without any filtering, paging, or sorting. So on postback the selected page is always 0, the sort order null... filtering null.

    This strange behaviour only occurs in modal dialogs. If we do use the same kind of grid (cause it's based on a adapter pattern will complete same implementation) it will work correctly.

    Grid implementation:

    <telerik:RadAjaxManagerProxy  ID="AjaxManagerProxy" runat="server" >
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="PanelButtonBar">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="PanelButtonBar" LoadingPanelID="RadAjaxLoadingPanel1"/>
                    <telerik:AjaxUpdatedControl ControlID="pnlMessage"/>
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManagerInGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="Grid">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Grid" LoadingPanelID="RadAjaxLoadingPanel1"/>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManagerProxy>

    If you already know this kind of issue and fixed it, please let me know. I realy do require an idea :)

    Best Regards,

    Jan

     

  2. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    1793 posts

    Posted 11 Apr Link to this post

    Hi Jan,

    I have gone through the scenario in question and the provided code snippet, but the information is not sufficient enough for making any suggestion on what could be causing the problem. Could you please share the markup and the code-behind of the page in question, so we can have a better idea of the exact implementation and how you are creating and binding the control. 

    Meanwhile, could you please ensure that you are not disabling the ViewState of the controls and that the control is not created dynamically in an event that will not preserve the ViewState.

    I am looking forward to your reply.


    Regards,
    Konstantin Dikov
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top