Closing RadWindow Issue

3 posts, 0 answers
  1. Aret
    Aret avatar
    29 posts
    Member since:
    Oct 2011

    Posted 27 Sep 2012 Link to this post

    I tried to use these Javascript calls to close my Radwindow, but it does not work at all:

    function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow;
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
            return oWindow;
        }

      function Close() {
            var oWindow = GetRadWindow();
            oWindow.argument = null;
            oWindow.close();
            return false;

        }

    I have a very old version of the telerik controls, probably dated back 2006-2007.  I checked many tutorials online such as the links below, but none of the methods are working for me.

    http://demos.telerik.com/aspnet-ajax/window/examples/clientsideevents/defaultcs.aspx
    http://www.telerik.com/community/forums/aspnet-ajax/window/close-radwindow-programmatically.aspx

    Any Suggestions....

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 01 Oct 2012 Link to this post

    Hello Aret,

    If you are using such an old version of the suite my best advise is to download the latest and test with it. The approach shown in the demos and forums should then work for you. You can see how to obtain a reference to the RadWindow in either of its modes in this online demo. If you are using a version that has a ContentTemplate and this is what you use then $find() is the approach you need, not the GetRadWindow() function.


    Greetings,
    Marin Bratanov
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. <span>w</span>
    <span>w</span> avatar
    84 posts
    Member since:
    Jun 2012

    Posted 13 Oct 2012 Link to this post

    My Dear, in order to close Radwindow , you can use this in javascript.
    1. Close Radwindow on button
    2. Close Radwindow on LinkButton
    3. Close Radwindow on ImageButton

        <script language="javascript">
                 function GetRadWindow() {
                     var oWindow = null;
                     if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog  
                     else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)         
                     return oWindow;
                 }

                 function closeWindow() {
                     GetRadWindow().Close();
                     GetRadWindow().BrowserWindow.location = parent.location;
                 }
        </script>

    <asp:Button ID="btn" runat="server" OnClientClick="closeWindow();" Text="Close RadWindow on Button" />
    <asp:LinkButton ID="lnkButton" runat="server" OnClientClick="closeWindow();" Text="Close RadWindow on LinkButton"></asp:LinkButton>
    <asp:ImageButton ID="imgButton" runat="server" OnClientClick="closeWindow();" ImageUrl="~/Images/close.png" />

    Regards
    Muhammad Waseem
Back to Top