How to Close RADWindow from Web Page specified as NavigateURL

5 posts, 0 answers
  1. Vikas
    Vikas avatar
    2 posts
    Member since:
    Aug 2011

    Posted 17 Aug 2011 Link to this post


    I am using RADWindow on Master page, when user clicks any button I have a JavaScript that finds, sets the NavigateURl property of RADWindow control as follows:


    script type="text/javascript">  


    function OpenCreateVirtualFarmWindow(button, args) {  

    var oManager = GetRadWindowManager();  

    var oWnd = oManager.getWindowByName("CaasRADWindow");  

    oWnd.SetSize(400, 400);



    return false;   




    Step 2) Inside the CreateFarm.aspx we have  a "Create" and "Cancel" button, I want to close this RADWindow when the user hits Cancel button. How to achieve that in the CreateFarm.aspx.cs, I mean how do I get reference to instance of RADWindow and CLOSE it?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Aug 2011 Link to this post

    Hello Vikas,
    Try the the follwing client side code in the CreateFarm page to close the window.
    <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 closeWindow()
            var oWnd = GetRadWindow();

  3. jlj30
    jlj30 avatar
    102 posts
    Member since:
    Jan 2011

    Posted 09 Mar 2012 Link to this post


    Thanks for the code.
    I too had a need for this and it worked like a charm.

  4. DEBAL
    DEBAL avatar
    22 posts
    Member since:
    Oct 2012

    Posted 23 Mar 2012 Link to this post

    Shinu I have used same code , but when runs on IE then it throws error on GetRadWindow() , But in firefox and Mozilla are  working  fine. I Have simple PopUp window where there is some information user will create and there is two button like Submit and Cancel .  If user submitt button click then those information will bind in suppose for simplicity TextBox and if user click on Cancel button then PopUp window should vanish/close.

    How to do this using Telerik Rad Window . Here is below code in design page :

     <telerik:RadWindowManager runat="server" Modal="True" Windows="RadWindow1" ID="radmanager">
                    <telerik:RadWindow ID="RadWindow1" Animation="Fade" Behaviors="Close" VisibleStatusbar="False"
                        runat="server"  Height="240px" Width="198px">
                                        <asp:Button ID="Button2" runat="server" Text="Ok" />
                                        <asp:Button ID="Button3" runat="server" Text="Cancel" OnClick="CloseWindow()"/>

    But  CloseWindow() function not working. The Code is same as described by you.
    Thanks ,
  5. Marin Bratanov
    Marin Bratanov avatar
    5929 posts

    Posted 23 Mar 2012 Link to this post


    The GetRadWindow() function is designed for the content page, not for the ContentTemplate. In this case you are still in the context of the main page and thus you need to get a reference to the RadWindow in the standard AJAX way - via $find(). This is shown in the following online demo:

    All the best,
    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.
Back to Top