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

Closing windows

3 Answers 58 Views
Window
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 21 Nov 2011, 11:45 AM
I have an app where, in any number of places, I open a RadWindow and then the user's interaction with that window will open another RadWindow.

We've been doing this for an age and it all works fine.

Now, however, I have a RadWindow that opens and that window's page includes the definition of another RadWinow with a ContentTemplate.

This, inner, window is defined like this...
<telerik:RadWindow runat="server"
                   ID="winUpload" 
                   Width="650px"
                   Height="500px"
                   Modal="true"
                   ReloadOnShow="true"
                   KeepInScreenBounds="true"
                   ShowContentDuringLoad="false">
  <ContentTemplate>
  <div>
  <!-- content -->
      <div class="clbDialogButtons">
                    <telerik:RadButton ID="UploadConfirmButton"
                                       runat="server"
                                       style="margin-left:3px"
                                       Text="Upload"/>
                      
                    <telerik:RadButton ID="UploadCancelButton"
                                       runat="server"
                                       style="margin-left:3px"
                                       Text="Cancel"
                                       AutoPostBack="false"
                                       CausesValidation="false"
                                       OnClientClicked="ClosePopup"/> 
      </div>
    </div>
  </ContentTemplate>     
</telerik:RadWindow>
and the ClosePopup function is defined thus...
function ClosePopup(sender, e)
{
    GetRadWindow().close();
}

My problem is that when the Close button is clicked in the inner window it closes both the inner window and the containing window.

How do I get just the inner window to close?

--
Stuart


3 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 21 Nov 2011, 11:48 AM
Hmm.

I can get it to work properly by doing this ...
function ClosePopup(sender, e)
{
    $find("<%=winUpload.ClientID %>").close();
}

But I'd still be interested to learn the proper way to do this.

--
Stuart

 


0
Accepted
Kevin
Top achievements
Rank 2
answered on 21 Nov 2011, 02:24 PM
Hello Stuart,

I believe that is the only proper way to close it, although you could use sender.close(), since I'm assuming the sender is the RadWindow that is being closed.

The reason GetRadWindow doesn't work is because the RadWindow with the ContentTemplate doesn't render in an iframe so that code logic doesn't work, thus the reason it closes the parent window.

I hope that helps.
0
Stuart Hemming
Top achievements
Rank 2
answered on 21 Nov 2011, 02:32 PM
Thanks Kevin.

--
Stuart
Tags
Window
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Kevin
Top achievements
Rank 2
Share this question
or