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

Client Close Problem

2 Answers 67 Views
Window
This is a migrated thread and some comments may be shown as answers.
Hakan
Top achievements
Rank 1
Hakan asked on 31 Jul 2010, 01:08 PM
I want to close window.When I click a button.
But javascript code gives an error window value null.oWindow value always null.This code runs on usercontrol
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
        function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow) oWindow = window.radWindow;
                else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
                alert(oWindow);
                oWindow.close();
            }
  
   
        </script>
    </telerik:RadScriptBlock>
<telerik:RadWindow ID="mdlPopup"  runat="server" Title="Bilgi Ekranı" Skin="Windows7"
    Width="440px" Height="150px" Modal="true" Top="50%" Left="50%" Behaviors="Close,Move"
    EnableShadow="false" VisibleStatusbar="False" >
    <ContentTemplate>
        <div style="padding: 10px">
            <table cellpadding="3" style="width: 100%">
                <tr>
                    <td valign="middle" style=" padding-left:20px">
                        <asp:Image ID="imgWarning" runat="server" ImageAlign="AbsMiddle" />
                    </td>
                    <td style=" height:60px">
                        <asp:Label ID="lblMessage" Font-Bold="false" runat="server" ForeColor="#1E395B"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="center" colspan="2">
                        <input id="Button1" type="button" onclick="javascript:GetRadWindow();" value="button" />
                         
                    </td>
                </tr>
            </table>
        </div>
    </ContentTemplate>
</telerik:RadWindow>

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 03 Aug 2010, 12:49 PM
Hello Hakan,

The GetRadWindow() function is used only when RadWindow displays a content page - i.e. the content page is displayed in an IFRAME. In your case, you are using RadWindow as a content template, i.e. the content is on the same page and that is why oWindow will always return null. If you want to close the window in such case, you only need to get a reference to it by using $find() and then call its close() method.



Best wishes,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Hakan
Top achievements
Rank 1
answered on 05 Aug 2010, 04:12 PM
Thank you problem solved
Tags
Window
Asked by
Hakan
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Hakan
Top achievements
Rank 1
Share this question
or