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

Determine if Page is loaded in RadWindow

2 Answers 133 Views
Window
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 20 Jul 2010, 06:43 PM
Question: How can I determine at the server side, if the page is being rendered in a radWindow?

Background: I have a Master page with toolbar buttons.  The child page is loaded in an iframe.  The user can click a toolbar button which posts a message to the parent window where another child page is loaded in a radwindow.

Because all of these child pages can appear in the IFrame, they need the toolbar buttons that load other reference pages in a radwindow, but I don't want to provide this option if the page itself has been loaded in a radWindow.

Example:
  The site has Pages A, B, and C.  Each page dynamically tells the parent the toolbar buttons available based on the state of the data, user permission, etc.  When viewing page A, users need the ability to quickly reference pages B and C.  When viewing Page B, users need the ability to quickly reference pages A and C, and so on.

When a page is displayed in this dialog, I'd like to be able to remove the popup toolbar buttons so that the modal window cannot open up additional windows.

2 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 22 Jul 2010, 02:50 PM
Hi Daniel,

Basically, you cannot check on the server if a certain page is displayed in an IFRAME (RadWindow is basically an IFRAME) or not. Such check can be done only on the client by using a slightly modified version of the GetRadWindow() function:

function GetRadWindow()
{
    var oWindow = null;
    if (window.radWindow) oWindow = window.radWindow;
    else if (window.frameElement && window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
    return oWindow;
}
 
function CheckWnd()
{
    var wnd = GetRadWindow();
    if (wnd)
    {
        alert("This page is loaded in a RadWindow");
    }
    else
    {
        alert("The page is loaded in the browser");
    }
}


Best wishes,
Georgi Tunev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Daniel
Top achievements
Rank 1
answered on 22 Jul 2010, 06:39 PM
I found that javascript solutions wouldn't work for me because my toolbar is rendered on the server side.  The simplest alternative was to add a query string parameter to the URL passed to the radOpen method.
Tags
Window
Asked by
Daniel
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or