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

Maximize RadWindow from inside User Control

4 Answers 153 Views
Window
This is a migrated thread and some comments may be shown as answers.
YongGang Che
Top achievements
Rank 1
YongGang Che asked on 15 Jul 2009, 05:30 AM
Hi, I have a RadWindow:
<radW:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Office2007">  
   <Windows> 
      <radW:RadWindow ID="RadWindow1" runat="server" Left="" NavigateUrl="" SkinsPath="~/RadControls/Window/Skins" 
         Title="" Top="" /> 
   </Windows> 
</radW:RadWindowManager> 
It contains an aspx page:
RadWindow1.NavigateUrl = "~/Pages/PlotManagerWindow.aspx"
There is an User Control - myUC in the aspx page. And in myUC, there is an RadioButtonList.

My question is how can I maximize RadWindow when user click the RadioButtonList?

I have tried multi ways, add following code to myUC:
<script type="text/javascript">  
   function ExecuteWindowCommand()  
   {  
      var oWnd = GetSelectedWindow();  
      oWnd.Maximize();  
   }  
 
   function GetSelectedWindow()  
   {  
      var oManager = GetRadWindowManager();  
      return oManager.GetActiveWindow();  
   }  
</script> 
But it seems like GetSelectedWindow() can't find RadWindow, so return null.

And also this task can't be done from code-behind.

Any help is appreciated.

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 15 Jul 2009, 07:40 AM

Hi YongGang Che,

I guess there is no active windows when you tried to use GetActiveWindows() method to get window client side object, and thereby getting the error. Try setting the window as Active onloading and see whether that make any difference.

ASPX:

 
<radW:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Office2007" OnClientShow="OnClientShow">  
    <Windows> 
       . . .  
    </Windows> 
</radW:RadWindowManager> 

JavaScript:

 
<script type="text/javascript">  
function OnClientShow(radWindow)  
{  
   radWindow.SetActive();  
}  
</script> 

Feel free to share the comments.

Thanks,
Princy.

0
YongGang Che
Top achievements
Rank 1
answered on 16 Jul 2009, 01:42 AM
Hi Princy,
Thanks for your help. But your solution didn't work for me.

Now I get the error: Object expected
when I call GetRadWindowManager.
function GetSelectedWindow()  
{  
   var oManager = GetRadWindowManager();  
   return oManager.GetActiveWindow();  
If I call the following code, I got the same result:
GetRadWindowManager().MaximizeAll();return false

Because my UI structure is nested, RadWindow is the most outside one.
I doubt RadWindow is out of scope of the above javascript function.
0
Fiko
Telerik team
answered on 16 Jul 2009, 01:23 PM
Hello YongGang,

I am not quite sure that understood your scenario but I prepared a demo based on the provided information. Could you please check it attached to the thread and let me know whether it fits your requirements? In case that your scenario is different and you need further assistance, please rework the attached demo in order to replicate your setup, open a new support ticket and send it back. Once I have a better view over your setup I will do my best to provide a working solution as soon as possible.

Best wishes,
Fiko
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.
0
YongGang Che
Top achievements
Rank 1
answered on 17 Jul 2009, 01:18 AM
Hi Fiko,

you fully understand my scenario and solved my problem!

Thanks a lot. Have a nice day.

Regards,
Yong Gang
Tags
Window
Asked by
YongGang Che
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
YongGang Che
Top achievements
Rank 1
Fiko
Telerik team
Share this question
or