Question

I found a small problem with my asp website. Here is the principle. -> I set a popup window to allow a user sends an email alert bug. And when the email is sent, I would send the name of the current page of the user. However this returns me the name of the popup window and not the parent page ....

How to retrieve the name page ('.aspx') of the "Parent" page from the radwindow (popup) ?

i have try this but it's not working

Was it helpful?

Solution

Can you try that :

//myWindow beeing the popup 
myWindow.document.write("<br><br>" + myWindow.opener.document.location.href + "")

Update

If you cannot get the popup window object you can pass the url of the calling window in the query string :

radopen('urlOfThePopup.aspx?opener=' + document.location.href, ...)

Then in your popup code

<%=Request.Querystring("opener")%> 

OTHER TIPS

From within the popup window's hosted HTML you can access the hosting page's DOM with a snippet of Javascript such as the following:

  <script>
     alert(window.top.document.title);
  </script>

This will return to you a nice alert box with the title of the page hosting the RadWindow.

Assuming you have a RadWindow and not an actual browser popup, this is the code you'll need:

// This is a common function when dealing with RadWindows and could be placed in some shared location
function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}

// Use it like this
var parentTitle = GetRadWindow().BrowserWindow.document.title;

What exactly are you trying to get? A page has a title, not a name. Anyway, take a look at this: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html. It will show you how to call a JavaScript function on the main page so it can return whatever JS object you need.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top