RadPersistenceManager filter by not displayed

3 Answers 34 Views
Grid
Lev
Top achievements
Rank 1
Iron
Lev asked on 09 Jun 2021, 03:28 PM | edited on 24 Jun 2021, 01:00 PM

Hi, I am trying to use Persistence Framework in old existing project. The way RadGrid is used in that application, is by opening new aspx page for edit or add record, and then re open main page.

So when Add button is clicked I am saving Grid settings in Session

            RadPersistenceManager PersistenceManager1 = RadPersistenceManager.GetCurrent(Page);
            PersistenceManager1.StorageProviderKey = m_strPersistenceKey;
            SessionStorageProvider.StorageProviderKey = m_strPersistenceKey;
            PersistenceManager1.SaveState();
            Response.Redirect("TblMaint_TableDataForm_Tableau.aspx");

Then in OnNeededDataSource load back Grid state

            RadPersistenceManager PersistenceManager1 = RadPersistenceManager.GetCurrent(Page);
            PersistenceManager1.StorageProviderKey = tblName;
            PersistenceManager1.LoadState();

The problem is, that grid correctly displaying sorting, if it was used and correctly filtering records when filter was used for the column, but there is no visual notification that filtering is using. It only appears when clicking again on filter and selecting one of the options. For example "No filter". Since grid still persisting previous values, filtering stays the same, but visually it now correctly displaying value for filter and column that is used for filter.

 

UPDATE: [Attachment removed by Progress Admin]

Attila Antal
Telerik team
commented on 24 Jun 2021, 01:02 PM

I've removed the attachment as it contained the Commercial assemblies. To avoid legal consequences, please do not share commercial versions of the Telerik Assemblies publicly.

3 Answers, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 14 Jun 2021, 08:13 AM

Hi Lev,

Restoring the State only is not enough. You will also need to call the Rebind() method of RadGrid to refresh its state. You can see the implementation in the Persisting Grid Settings online demo.

Since the Rebind() method cannot be called inside the NeedDataSource you will need to use another event.

For example, you can try the PreRender event and create a condition that will check for the Grid state. If it's present,  restore the state then Rebind.

Regards,
Attila Antal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Lev
Top achievements
Rank 1
Iron
commented on 21 Jun 2021, 07:30 PM

Hello, I tried that approach, still does not work. I attached sample to the original post. Maybe it has something to do with master page and PersistenanceManagerProxy.
Lev
Top achievements
Rank 1
Iron
commented on 22 Jun 2021, 01:53 AM | edited

I think it might be somehow related to AutoGenerateColumns Property of the grid. When it set to "false" and columns listed it works. When set to "true", filter value is not displayd on postback.
0
Lev
Top achievements
Rank 1
Iron
answered on 22 Jun 2021, 01:35 PM
StateLooad call should be right before grid rebound method and not in the NeededDataSource event. PreRender event is a good candidate.
0
Attila Antal
Telerik team
answered on 24 Jun 2021, 05:53 PM

Hi Lev,

I was unable to run the sample you shared as it won't load for unknown reasons.

Nevertheless, I looked at the source code, and based on that I've created a similar sample. I used Master/Content pages with RadPersistenceManager and RadPersistenceManagerProxy. The Columns are autogenerated and the project seems to be working fine.

You can download and test the sample from the attachment.

Documentation articles on the topic can be found below:

 

Test the sample and let see if that will help resolve the issue. If not, you can modify it and make it replicate the problem. Send the problematic sample back to me and I will troubleshoot it.

 

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Lev
Top achievements
Rank 1
Iron
Answers by
Attila Antal
Telerik team
Lev
Top achievements
Rank 1
Iron
Share this question
or