Hi.
I'm using a RadWindow to give the user a modal dialog where he can enter some additional data before an action takes place. However, I'm having an issue stiching the whole thing together. The user clicks a RadToolBarButton to activate the dialog. I need a post-back to take place, as the page shown in the RadWindow needs something set in Page.Session to work properly.
First, I attempted doing everything server-side. It works, but the code becomes very "dirty". I'll explain. When the user clicks the RadToolBarButton, I set these two attributes on the RadWindow:
It causes the Window to show up, and since I've set the Session during the postback, everything works like a charm. However, *every* possible action the user could take after the RadWindow has been shown, will show the window again. The only way I found to remedy that, was to put the following call in every possible place a postback could take place on the page. Suffice to say, it's not pretty:
What if I add something new that does a postback, and I forget to include this code piece? It's going to cause it to pop up on every page load again. It's not sustainable.
My other attempt was to try to mix server and client side. After all, I only need the server to set a Session variable. I placed the RadWindow inside a RadWindowManager, and called the following code in the OnClientButtonClicking event:
It shows the window as it should, but the post-back caused by the click to the button causes the page to reload (naturally), and after the reload, the window is gone. Also, even if I got the postback to take place without the page actually reloading, I'm afraid the page in the Window could load before the postback has taken effect, leaving the window page without the proper Session variable set. Quite honestly, I'm feeling a little stumped. What's the proper solution to this?
I'm using a RadWindow to give the user a modal dialog where he can enter some additional data before an action takes place. However, I'm having an issue stiching the whole thing together. The user clicks a RadToolBarButton to activate the dialog. I need a post-back to take place, as the page shown in the RadWindow needs something set in Page.Session to work properly.
First, I attempted doing everything server-side. It works, but the code becomes very "dirty". I'll explain. When the user clicks the RadToolBarButton, I set these two attributes on the RadWindow:
Window.VisibleOnPageLoad = true; |
Window.Visible = true; |
It causes the Window to show up, and since I've set the Session during the postback, everything works like a charm. However, *every* possible action the user could take after the RadWindow has been shown, will show the window again. The only way I found to remedy that, was to put the following call in every possible place a postback could take place on the page. Suffice to say, it's not pretty:
private void HideWindow() |
{ |
Window.VisibleOnPageLoad = false; |
Window.Visible = false; |
} |
What if I add something new that does a postback, and I forget to include this code piece? It's going to cause it to pop up on every page load again. It's not sustainable.
My other attempt was to try to mix server and client side. After all, I only need the server to set a Session variable. I placed the RadWindow inside a RadWindowManager, and called the following code in the OnClientButtonClicking event:
var man = GetRadWindowManager(); |
man.open(null, "Window"); |
It shows the window as it should, but the post-back caused by the click to the button causes the page to reload (naturally), and after the reload, the window is gone. Also, even if I got the postback to take place without the page actually reloading, I'm afraid the page in the Window could load before the postback has taken effect, leaving the window page without the proper Session variable set. Quite honestly, I'm feeling a little stumped. What's the proper solution to this?