Persistencemanager proxy not working

10 posts, 0 answers
  1. ankita
    ankita avatar
    5 posts
    Member since:
    May 2016

    Posted 30 May Link to this post

    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

  2. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 02 Jun Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ankita
    ankita avatar
    5 posts
    Member since:
    May 2016

    Posted 02 Jun in reply to Kostadin Link to this post

    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

  5. ankita
    ankita avatar
    5 posts
    Member since:
    May 2016

    Posted 06 Jun in reply to Kostadin Link to this post

    Hi,

    Can someone provide any helpful details.

    Thanks,

    Ankita

  6. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 07 Jun Link to this post

    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.
  7. ankita
    ankita avatar
    5 posts
    Member since:
    May 2016

    Posted 08 Jun in reply to Kostadin Link to this post

    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.

  8. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 13 Jun Link to this post

    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.
  9. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 07 Sep in reply to Kostadin Link to this post

    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

  10. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 12 Sep Link to this post

    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.
  11. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 12 Sep in reply to Kostadin Link to this post

    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

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017