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

RadGrid saves some settings, but not all!

8 Answers 143 Views
Persistence Framework
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 11 Sep 2015, 11:57 PM

I have a situation where the RadGrid Filter criteria is saved, but, the RadGrid doesn't execute the Filter expression (yes, I tried ReBind()) upon re-loading Persistence.  Also, Sorts are not re-loaded either.  Only the Filter criteria value is re-loaded upon returning to the page.

 

I have a RadTabStrip with (3) RadGrids.  I implemented RadPersistenceManager with PersistenceSettings for each RadGrid, loading and saving with Page_Load and Page_Unload (code below, if needed).  Everything was working great; Sort & Filter were the same when I returned from exiting the app or returning from another page.  Something changed, though.  I'm not sure where.  The RadGrid Filter criteria is saved, but, the RadGrid doesn't execute the Filter expression, and the Sorts don't re-load.  What could've possibly happened to cause this?

 

 

 <telerik:RadPersistenceManager ID="RadPersistenceManager_AssetTabs" runat="server">
    <PersistenceSettings>
        <telerik:PersistenceSetting ControlID="RadGrid1" />
        <telerik:PersistenceSetting ControlID="RadGrid2" />
        <telerik:PersistenceSetting ControlID="RadGrid3" />
    </PersistenceSettings>
</telerik:RadPersistenceManager>

 

protected void Page_Load(object sender, EventArgs e)

{
    string theKey = "TelerikAspNetRadControlsPersistedState";
    theKey = "StorageProvider_" + Session["UserName"].ToString();
    RadPersistenceManager_AssetTabs.StorageProviderKey = theKey;
    var fileNameAndPath = Server.MapPath("~/App_Data/" + theKey);

    //bool IsPersistenceLoaded = (bool)Session["PersistenceLoaded"];
    if (File.Exists(fileNameAndPath)) // && !IsPersistenceLoaded)
    {
        try
        {
            if (!IsPostBack)
            {
                RadPersistenceManager_AssetTabs.LoadState();
            }
        }
        catch (Exception theError)
        {
            Console.WriteLine("Exception for RadPersistenceManager LoadState: {0}", theError);
        }
    }
}

protected void Page_Unload(object sender, System.EventArgs e)
{
    try
    {
        RadPersistenceManager_AssetTabs.SaveState();
    }
    catch (Exception theError)
    {
        Console.WriteLine("Exception for RadPersistenceManager SaveState: {0}", theError);
    }
}

‚Äč

8 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 14 Sep 2015, 06:43 PM

*** Update with possible workaround ***

In my post above, only the Filter criteria value was re-loaded upon returning to the page, not the Sorts, column resize, or executing the filter itself.  In other forum posts, they mentioned that you can't use Load On Demand coupled with the Persistence Manager.  I didn't have Load On Demand invoked, on these (3) RadGrids; however, I had OnNeedDataSource invoked.  Apparently, they are akin to each other.  So, I removed OnNeedDataSource and declaratively implemented DataSourceID="<objectDataSource>".  Problem solved for now.

 

I implemented OnNeedDataSource because it was suggested to me, by Telerik Support, that in order to improve Filter/Sort/Paging performance, I must ‚Äčimplement Advanced Data Binding using OnNeedDataSource.  Until I find out differently, Advanced Data Binding and Persistence Manager seem to be in conflict with each other.  Please advise.  Thank you.

 

0
Angel Petrov
Telerik team
answered on 15 Sep 2015, 08:00 AM
Hello,

I have already provided an answer in the official support ticket you have opened regarding this matter. As soon as we are able to resolve the matter you can share your findings with the community thus helping other members overwhelm such situations.

Regards,
Angel Petrov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Anthony
Top achievements
Rank 1
answered on 10 May 2016, 08:43 PM

I'm currently working on implementing persistence as well and use OnNeedDataSource with various grids. Any followup regarding a solution to the issue discussed here?

 

Regards

0
Kostadin
Telerik team
answered on 13 May 2016, 11:16 AM
Hi Anthony,

Generally there should be a problem persisting the grid setting in case you are using an advanced databinding. I prepared a small sample where the persistence is working correctly and attached it to this thread. Could you please give it a try and let me know how it differs from your real setup?

Regards,
Kostadin
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
james
Top achievements
Rank 1
answered on 24 Jul 2018, 10:12 PM

I don't see Advanced data binding used in your example. I'm experiencing the same problem -- the filter values are persisted but the filter function does not execute. Is there a resolution to this issue? 

James

0
Jim
Top achievements
Rank 1
answered on 25 Jul 2018, 03:38 PM

I have been trying to identify the solution to this issue for a while. In my case, I submitted a support ticket and was provided with an example for a SessionStorageProvider, which was not the applicable in my case. MyDSStorageProvider solution was outlined here: https://docs.telerik.com/devtools/aspnet-ajax/controls/persistenceframework/functionality/-custom-storage-provider

I wanted to load a specific filter based on a querystring, so I did some testing and figured out that if I loaded state on PreRender, it would load column order and visibility AS WELL AS filtering.

I hope this helps someone else.

protected void LoadSavedFilter(string filterID)
{
    RadPersistenceManager1.StorageProviderKey = filterID;
    RadPersistenceManager1.LoadState();
    RadGrid1.Rebind();
}
 
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        if (sFilterId != "") { LoadSavedFilter(sFilterId); }
    }
}
0
Peter Milchev
Telerik team
answered on 27 Jul 2018, 12:13 PM
Hi Jim,

Thank you for sharing your solution with the community. 

I think that the samples provided in the following forum post would also be helpful and are worth checking out: https://www.telerik.com/forums/maintaining-radgrid-current-page-row-index-after-navigating-away-from-radgrid-page#rgdADpzb0k-WBYUvmWT2kw

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
John
Top achievements
Rank 1
answered on 04 Apr 2019, 10:37 AM
Jim, Thanks for providing this info!
Tags
Persistence Framework
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Angel Petrov
Telerik team
Anthony
Top achievements
Rank 1
Kostadin
Telerik team
james
Top achievements
Rank 1
Jim
Top achievements
Rank 1
Peter Milchev
Telerik team
John
Top achievements
Rank 1
Share this question
or