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

Persistencemanager proxy not working

11 Answers 312 Views
Persistence Framework
This is a migrated thread and some comments may be shown as answers.
ankita
Top achievements
Rank 1
ankita asked on 30 May 2016, 12:33 PM

Hi,

I have requirement where on 1 main aspx page i have 3 user controls(ascx).

Each ascx has a radgrid.I need to save state of each grid in database individually on gridbutton click.

Tried- I have created a custom storage provider and implemented methods SaveStateToStorage and LoadStateFromStorage.

Now if I apply persistencemanger on any ascx and call .savestate it goes to SaveStateToStorage  and all works fine.

But if I move persistencemanger  to aspx and apply persistencemangerproxy on ascx nothing works.

Sample code-

on aspx-  <telerik:RadPersistenceManager  ID="mainPersistenceManager" runat="server">   </telerik:RadPersistenceManager>

on aspx.vb- pageload event -  mainPersistenceManager.StorageProvider = New SettingsStorageProvider() 'This is my custom storage provider

on ascx- <telerik:RadPersistenceManagerProxy  ID="PersistenceManagerProxy1" runat="server" UniqueKey ="1">

        <PersistenceSettings>
            <telerik:PersistenceSetting ControlID="radgrid1" />
        </PersistenceSettings>
    </telerik:RadPersistenceManagerProxy>

on ascx.vb- on button click event-

 Dim ascxPersistenceManager As RadPersistenceManager

 ascxPersistenceManager = RadPersistenceManager.GetCurrent(Page)
       ascxPersistenceManager.PersistenceSettings.AddSetting("radgrid1")
        SettingsStorageProvider.StorageProviderKey = Key
        ascxPersistenceManager .SaveState()

 

Now on button click i get exception that it could not find control with id=radgrid1

but if i comment this line "ascxPersistenceManager.PersistenceSettings.AddSetting("radgrid1")"

somehow it calls "LoadStateFromStorage" of my custom storage provider rather than "SaveStateToStorage" method.

 

Incase when i dont use proxy and put persistencemanger in ascx only it hits correct method but not in case of proxy.

Please help 

 

Thanks,

Ankita

11 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 02 Jun 2016, 08:02 AM
Hello Ankita,

I would recommend you to examine the following help article which elaborates more on persisting multiple grid with RadPersistenceManagerProxy. The hoe to article demonstrates how to persist the grid setting by using the default storage provider but the approach is similar when using a custom one.

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
ankita
Top achievements
Rank 1
answered on 02 Jun 2016, 03:29 PM

Hi Kostadin,

Thanks but I already tried that one,not helping.I have added the unique key to the proxy in user control html itself.

If you see the code i wrote its similar,however it's still not working.

If I add the radgrid control of ascx to the instance of radpersistencemanager it throws exception of control not found.

However if I don't, as I already mentioned in the post on savestate the LoadStateFromStorage method of custom storage is called rather than the SaveStateToStorage method of custom storage class.

 

Can you please help me with this or provide an example working solution of custom storage(implementing IStateStorageProvider ) having a main aspx page and 2 ascx both having a radgrid.

Like the one I m trying to do.

 

Thanks,

Ankita

0
ankita
Top achievements
Rank 1
answered on 06 Jun 2016, 09:46 AM

Hi,

Can someone provide any helpful details.

Thanks,

Ankita

0
Kostadin
Telerik team
answered on 07 Jun 2016, 07:53 AM
Hello Ankita,

Could you please let me know which version of the Telerik Web UI for ASP.NET you are using? I would recommend you to use the latest version and check whether your sample is working correctly. Additionally I would suggest you to test the sample from my previous reply and let me know whether the sample is working in your case. I would appreciate if you can replicate the issue in the provided sample, so I can examine it locally.

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
ankita
Top achievements
Rank 1
answered on 08 Jun 2016, 01:58 PM

I'm using version - 2014.2.618.45  ,However i tried with the latest dll too, but again same thing is happening.

On calling savestate method of radpersistencemanager the LoadStateFromStorage method of my storage provider class is getting called though SaveStateToStorage method should be called in this case.

This is happening only when I m using the proxy on user control.

If I just implement radpersistence manager on user control ans then call the savestate method , the correct SaveStateToStorage method of custom storage class is called.

My code of main page and user control is there in my first post.Its same as in the example link provided earlier by you.

I m attaching my custom storage provider code.

You can use this vb file in the project and check the issue.

I have been stuck on this issue for quite a long time now, nothing seems to be happening at all and it's very frustrating.

Very much appreciate any help in resolving this issue asap.

0
Kostadin
Telerik team
answered on 13 Jun 2016, 11:01 AM
Hi Ankita,

I prepared a small sample where I used custom storage provider and user controls. Could you please check it out and let me know how it differs form 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
Vasssek
Top achievements
Rank 1
answered on 07 Sep 2016, 10:28 PM

Hello,

I have the same problem as Ankita. When I call in my ascx.cs savestate method of radpersistencemanager the LoadStateFromStorage method of my storage provider class is getting called though SaveStateToStorage method should be called in this case.

Your example I couldn't use because the control which I need to add to RadPersistenceManagerProxy comes from parent page and not directly from ascx.

Please help me to solve this issue. My dlls are 2016.2.809.40, I have also tried some older but without success.

Best regards

Vasssek

0
Kostadin
Telerik team
answered on 12 Sep 2016, 10:57 AM
Hi Vasssek,

Could you please prepare a small runnable sample and send it to us in order to investigate it further? I tried to replicate the issue in the previously provided sample but on my side works correctly. Please check out the attached sample and let me know how it differs from your real setup?

Regards,
Kostadin
Telerik by Progress
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
0
Vasssek
Top achievements
Rank 1
answered on 12 Sep 2016, 03:07 PM

Hello,

Since I have not enough time to test this for you, I have done some small workaround which is quite sufficient for me.

Here it is:

Before I call save method of radpersistance I store some value about saving process into session variable. Next step inside LoadStateFromStorage method I check whether this session variable exists or not. If yes then immediately return. If no, it continues with loading state...

Strange thing is that when I return from LoadStateFromStorage method then SaveStateToStorage is called. And that's what I want from the very beginning. Save grid persistance...

Maybe this whole issue is caused because of nested user control inside RadPageView with RadTabSstrip...

Best regards

Vasssek

0
Rayne
Top achievements
Rank 1
answered on 05 Apr 2018, 07:21 PM

I'm having the same issue. It appears that the state isn't being saved properly.

I have a Master Page, with Content pages and a custom storage provider.

in my page load, I'm calling LoadState if not postback. In PreRenderComplete, I call SaveState if is postback. So that column changes in my grid are saved immediately after they change.

On first pass, when I step through the code, I hit the call to SaveState, but that immediately goes into LoadStateFromStorage in my custom storage provider, which is nothing since it has never been saved before (no cookie exists, so call returns string.Empty). Once that call returns, it immediately goes into the SaveStateFromStorage, but at that point, the state being saved is the original empty one, since that is what loaded before going into SaveStateFromStorage.

Why is it doing this?

 

0
Vessy
Telerik team
answered on 11 Apr 2018, 06:32 AM
Hi Rayne,

Thank you for the detailed explanation. Unfortunately, it is not enough to pinpoint the root of the problem. Can you, please, open a standard support ticket and attach a runnable simplified version of your project in it, where we can reproduce and debug the problem further?

Thank you in advance for your cooperation.

Regards,
Vessy
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Persistence Framework
Asked by
ankita
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
ankita
Top achievements
Rank 1
Vasssek
Top achievements
Rank 1
Rayne
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or