Close Parent RadWindow from Content Page of Rad Pane

3 posts, 1 answers
  1. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 31 Oct 2011 Link to this post

    Hi All,
    I have a page called SearchForm.aspx  that has 2 rad panes with rad splitter
    In the first pane there is radiobutton list.on the SelectedIndexChanged event of it, i load a different pages(Page1.aspx, Page2.aspx) in the second pane using its conentURL property.

    The whole page(SearchForm.aspx) is called from button click from another page(Caller.aspx) using RadWindow....

    I need to close the SearchForm.aspx page from a button click from Page1.aspx or Page2.aspx

    as the demos says in the page1.aspx page i used the following javascript to close but oWindow returns null always and it doesn't close!!!!

    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      
        <script language="javascript" type="text/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)
      
                alert(oWindow);
                
                return oWindow;
            }
      
            function windowClose() {
      
              GetRadWindow().close();
                      }
             </script>
        </telerik:RadCodeBlock>

    Please Help....

    thanks

    Asa'ad
  2. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    4609 posts

    Posted 01 Nov 2011 Link to this post

    Hello Asa'ad,

    The pages you load in the RadPane are also loaded in iframes as this is the only way to load external pages in your form. This means that they create another level in the frame hierarchy and thus the RadWindow frame you are trying to access is one level up.

    What you should do is place this JavaScript in the SearchForm page, as it is the one directly loaded in the RadIWindow. Then you need to call the closeWindow() function from the Page1 that is loaded one level below, for example:
    window.parent.closeWindow();



    Kind regards,
    Marin
    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
  3. Asa'ad
    Asa'ad avatar
    77 posts
    Member since:
    May 2011

    Posted 02 Nov 2011 Link to this post

    thanks thats solved my problem ;-)
Back to Top