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

Showing RadWindow on Parent from Custom Control

5 Answers 118 Views
Window
This is a migrated thread and some comments may be shown as answers.
Quintin
Top achievements
Rank 1
Quintin asked on 03 Jul 2012, 08:39 PM
Hi,

I have a ascx user control on a page which has a cancel button and on the container/parent page is the RadWindow.

How do I show this parent RadWindow in Javascript onclick of the button?

Thanks

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 04 Jul 2012, 04:43 AM
Hi Quintin,

Try the following Javascript to achieve your scenario.

JS:
<script type="text/javascript" >
 function OnClientClick()
  {
    var oWnd = radopen("URL", "RadWindow1");
    return false;
  }
</script>

Hope this helps.

Thanks,
Princy.
0
Quintin
Top achievements
Rank 1
answered on 04 Jul 2012, 05:18 AM
Thanks for the reply Princy.

The RadWindow I am trying to open is defined on the parent page and contains a contenttemplate. I need to specifically open the instance defined on the parent page and not a new RadWindow with a URL.

I tried this from server side but the window does not display unless I set VisibleOnPageLoad = true but then the page continuously displays on postback:

RadWindow
 radWin = (RadWindow)this.Parent.FindControl("winListings");             
newOrderWindowManager.Windows.Add(radWin); 

Thanks!
0
rdmptn
Top achievements
Rank 1
answered on 04 Jul 2012, 07:45 AM
Why don't you just use JavaScript to open it then? Instead of setting its VisibleOnPageLoad property to true you should employ the approach from this thread:http://www.telerik.com/community/forums/aspnet-ajax/window/opening-radwindow-from-the-server.aspx. Once you access the control from the code-behind you can use its ClientID property.

An alternative is to add the OnClientClick script from the code-behind, something like :
RadWindow myRW = ....;//get your RadWIndow here by traversing the control tree 
myButton.OnClientClick = "$find('" + myRW.ClientID + "').show(); return false;";

0
Quintin
Top achievements
Rank 1
answered on 04 Jul 2012, 11:50 AM
Thanks, that may work. I guess my question is how do I go about traversing the parent controls?
0
rdmptn
Top achievements
Rank 1
answered on 06 Jul 2012, 07:48 AM
Just like you did in your previous post? I mean this line:
RadWindow radWin = (RadWindow)this.Parent.FindControl("winListings");
//and then you need
radWin.ClientID
Tags
Window
Asked by
Quintin
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Quintin
Top achievements
Rank 1
rdmptn
Top achievements
Rank 1
Share this question
or