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

GetRadWindow().close() doesn't work

4 Answers 147 Views
Window
This is a migrated thread and some comments may be shown as answers.
Uyen
Top achievements
Rank 1
Uyen asked on 12 Jul 2014, 03:43 AM
Hi all,

I call a RadWindow which contain an user control (frmEditSteps)

Parent Page:
<telerik:RadWindowManager ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="false"
          ReloadOnShow="true" runat="server" EnableShadow="true">
        <Windows>
            <telerik:RadWindow ID="RadWindow1" runat="server" Skin="Telerik" Behaviors="Close, Move" Modal="true" AutoSize="true" >
                <ContentTemplate>
                    <uc1:frmEditSteps runat="server" id="frmEditSteps" />  //My User Control
                </ContentTemplate>
            </telerik:RadWindow>
        </Windows>
</telerik:RadWindowManager>

After that, I close the RadWindow1 by clicking a button in user control. But it doesn't work.
User control frmEditSteps
<button title="Submit" id="close" onclick="ClosePopcmn(); return false;">Submit</button>
<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 ClosePopcmn() {        
        var oWnd = GetRadWindow();
        oWindow.close(); --------------------------> It doesn't work??????      
    }    
</script>
I don't know why.
But when I run Website on Internet Explorer, it generate an error at oWindow.close()
That error is: 0x800a138f - JavaScript runtime error: Unable to get property 'close' of undefined or null reference

Please help me.

4 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 14 Jul 2014, 04:42 AM
Hi Uyen,

Please have a look into this online demo which works as expected for me. Please provide your code if it doesn't help.

Thanks,
Shinu.
0
Marin Bratanov
Telerik team
answered on 14 Jul 2014, 09:39 AM

Hi guys,

When the ContentTemplate of the control is used, you can get a reference to it only through the $find() method MS AJAX offers. This is shown in the following demo: http://demos.telerik.com/aspnet-ajax/window/examples/contenttemplatevsnavigateurl/defaultcs.aspx.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Matt
Top achievements
Rank 1
answered on 23 Oct 2018, 05:12 PM
My problem is that it works in Dev but not on a remote server... which I can't find any workable solutions to. I can't easily make changes to IIS either...
0
Marin Bratanov
Telerik team
answered on 25 Oct 2018, 11:27 AM
Here's a link to the other thread where Matt solved his particular problem already: https://www.telerik.com/forums/radwindow-will-not-close-on-remote-server#Nv0dP5B0dUGgK9_tM6bC_A.
Tags
Window
Asked by
Uyen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Marin Bratanov
Telerik team
Matt
Top achievements
Rank 1
Share this question
or