Closing a RadWindow from a user control in the loaded page

2 posts, 0 answers
  1. Andrei
    Andrei avatar
    5 posts
    Member since:
    Jun 2008

    Posted 14 May 2009 Link to this post

    Hi there!

    I've run into a bit of a snag. I have a modal RadWindow that loads an aspx page containing just a user control. Inside that user control I have a button and I want to close the RadWindow when I press it. Any ideas how that could be accomplished?

    Thanks,
    Andrei
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 May 2009 Link to this post

    Hello Andrei,

    I would suggest to use the client-side API of the RadWindow and to get a reference to the window wrapper and call its close() method.
    e.g.
    <script type="text/javascript"
    function GetRadWindow() 
      var oWindow = null
      if (window.radWindow) 
         oWindow = window.radWindow; 
      else if (window.frameElement.radWindow) 
         oWindow = window.frameElement.radWindow; 
      return oWindow; 
    }   
     
    function closeWin() 
        //get a reference to the RadWindow 
        var oWnd = GetRadWindow(); 
        //call its close() method 
        oWnd.close(); 
    </script> 
    <asp:button id="Button1" runat="server" text="Close Window" OnClientClick="closeWin(); return false;"



    Sincerely yours,
    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.
Back to Top