Restore dynamic Telerik RadWindows on next postback
-
28-02-2021 - |
Domanda
I'm doing some ASP using Telerik.
On my page there are 2 buttons called Create Window
and Postback
. The Create Window
button created a new RadWindow
dynamically on it's click event (client-side) by using window.radopen()
. The Postback
button simply does a postback. My problem is that, the windows get lost after every postback. What can I do to make my RadWindows
to remain opened after a postback, including its content and position.
If there is no built-in function to restore my dynamic RadWindows, please tell me how to save current windows content to manually load it on the next postback. I thought of using a Hidden control to save my RadWindow position and content, but how can I do that (it's content is a user control with plentiful textboxes, and i don't want my customer to re-type all the textboxes).
Soluzione
The RadWindows are generated via JavaScript when they are first shown. You can easily check this via your developer plugin of choice. Once you show them they create their wrapper div as a direct child of the form element. This means that they have no server-side rendering and thus cannot be persisted on the server across postbacks.
What you can do is use AJAX - have the button perform an AJAX request that will update the needed content of the page, but will leave the RadWindows out of the update. Check out this help article where they explain how to use AJAX with a RadWindow: http://www.telerik.com/help/aspnet-ajax/radwindow-ajaxifying.html.