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

Close Parent RadWindow from Content Page of Rad Pane

2 Answers 152 Views
Window
This is a migrated thread and some comments may be shown as answers.
Asa'ad
Top achievements
Rank 1
Asa'ad asked on 31 Oct 2011, 10:55 AM
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 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 01 Nov 2011, 01:11 PM
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
0
Asa'ad
Top achievements
Rank 1
answered on 02 Nov 2011, 09:33 AM
thanks thats solved my problem ;-)
Tags
Window
Asked by
Asa'ad
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Asa'ad
Top achievements
Rank 1
Share this question
or