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

How to I access a RadWindow from a lower level Radwindow

1 Answer 37 Views
Window
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 24 Feb 2012, 04:29 PM
Hi

I have a very convoluted problem to try and describe to you all.

I have a RadWindow that is being opened from a User Control using show().

This works just fine. When the window's Save button is clicked a Client side java script function
is called to close the window and pass a parameter.

An OnClientClose function is then called which gets an Ajax Manager and triggers an ajaxRequest
which is handled by the user control.

I have a second situation where I am hosting the same User Control inside another RadWindow.

To get the second level RadWindow to display correctly I have to get the appropriate Window Manager
and call the open function on that window manager, passing the aspx and window name.

This seems to create a separate instance of the RadWindow which I have to programatically configure
with my required attributes, however I cann't wire up the close using add_close because of the stack overflow problem.
I tried the work around you mention in one of your articles. However that doesn't help either.

What I REALLY need is some way of notifying the first level RadWindow that the second level window has closed and it has a parameter being passed to it.  

Re-reading this I wonder if any of this will make sense, but I cann't figure out a solution so I thought I'd try and explain the problem.

TIA

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 28 Feb 2012, 11:58 AM
Hi Tim,

I am not sure I understand you completely, yet I can suggest you try a combination of the following
- a check if you are inside a RadWindow (which is explained here and here)
- in case you are in a RadWindow you can avoid using a OnCilentClose handler, but instead simply call a function from the parent page in the same place where you close the second level RadWIndow (i.e. the button OnClientClick handler)

This may require that you add a function to handle this logic in all parents that may host your user control, however, yet there isn't a better approach to handle a user control that depends on its context, as generally user controls should not depend on the context/parent. You could further extend this if you like to use the same approach for all cases - i.e. calling a function from the parent page instead of an onclientclose handler.


Kind regards,
Marin
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Window
Asked by
Tim
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or