Closing windows

4 posts, 1 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 21 Nov 2011 Link to this post

    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


  2. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 21 Nov 2011 Link to this post

    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

     


  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 21 Nov 2011 Link to this post

    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.
  5. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 21 Nov 2011 Link to this post

    Thanks Kevin.

    --
    Stuart
Back to Top