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

[Solved] How to access page from code behind

1 Answer 237 Views
Window
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 27 Jun 2008, 07:41 AM
I have a page that is built from a master page. This master page has the RadWindow instance in it. This is a login/registration page. On the code behind, I process that data and then need to have the main page redirect to the item that the user was loging in or registering for.

I try to access the page that is built from the master page that has the RadWindow in it by the following code:

This is similiar to the injection for closing the window, but the difference is that I need to inject in the main page, not the popup window.

RadWindow rwdRegistration = (RadWindow)Page.Parent.Page.Master.FindControl("RadWindow1"); 
             
Label lblInjectRedirect = (Label)rwdRegistration.Parent.FindControl("lblInjectRedirect"); 
 

Has anyone every tried to access a control from the pop up window in the main or parent window? If so can you please explain or show the code snippet to do this?

Thanks,
Patrick

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 27 Jun 2008, 07:59 AM
Hello Patrick,

I have just answered your support ticket on the same subject. For convenience I am pasting my reply below:

RadWindow is based on an IFRAME and is intended to replace the standard browser's popup (window.open()). Just like the popup and the IFRAME, RadWindow is simply a container that displays a content page, different from the parent. The framework itself will not allow you to access that page as it is a separate document.

What I suggest in your case is to change your logic and call the redirection script from the content page in the context of the parent:
<script type="text/javascript">
 function closeAndNavigateAway()
{
 var oWnd = GetRadWindow();
oWnd.close();
//top refers the topmost page which in this case will be the parent one
top.location.href = "http://mysite/mynewpage.aspx";
}
</script>


I hope this helps.



Best wishes,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Window
Asked by
Patrick
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or