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

Peculiar RadWindow issue

1 Answer 72 Views
Window
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 08 Mar 2009, 08:01 AM
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:

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?


1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 09 Mar 2009, 11:40 AM
Hi Alexander,

I am not quite sure if I understand your scenario completely, but if you wish to do all on server, I would suggest to use some check logic in Page_Load that will set VisibleOnPageLoad to false if certain conditions are met.
Another option is to change the logic and get the needed information passed to the content page not in the session but in the query string with which RadWindow was opened - this way you could open RadWindow on the client and it will not appear on following postbacks.

I hope this helps. If you still experience problems, please open a support ticket and send us a small sample project that reproduces your scenario. Just make sure it can be run locally and attach the project to the support thread.


Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Window
Asked by
Alexander
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or