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

Closing RadWindow Issue

2 Answers 92 Views
Window
This is a migrated thread and some comments may be shown as answers.
Aret
Top achievements
Rank 1
Aret asked on 27 Sep 2012, 07:05 PM
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 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 01 Oct 2012, 08:07 AM
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.
0
Waseem
Top achievements
Rank 1
answered on 14 Oct 2012, 02:31 AM
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
Tags
Window
Asked by
Aret
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Waseem
Top achievements
Rank 1
Share this question
or