Maximize RadWindow from inside User Control

5 posts, 0 answers
  1. YongGang Che
    YongGang Che avatar
    3 posts
    Member since:
    Jul 2009

    Posted 15 Jul 2009 Link to this post

    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.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 15 Jul 2009 Link to this post

    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.

  3. YongGang Che
    YongGang Che avatar
    3 posts
    Member since:
    Jul 2009

    Posted 15 Jul 2009 Link to this post

    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.
    1 function GetSelectedWindow()  
    2 {  
    3    var oManager = GetRadWindowManager();  
    4    return oManager.GetActiveWindow();  
    5
    If I call the following code, I got the same result:
    1 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.
  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 16 Jul 2009 Link to this post

    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.
  5. YongGang Che
    YongGang Che avatar
    3 posts
    Member since:
    Jul 2009

    Posted 16 Jul 2009 Link to this post

    Hi Fiko,

    you fully understand my scenario and solved my problem!

    Thanks a lot. Have a nice day.

    Regards,
    Yong Gang
Back to Top