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

RadGrid loses sort and page index after postback

1 Answer 148 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 06 Apr 2016, 08:49 AM

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

 

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 11 Apr 2016, 08:56 AM
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.
Tags
Grid
Asked by
Jan
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or