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

*** 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.
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

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
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

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

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); }
}
}
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
