Determine if Page is loaded in RadWindow

3 posts, 0 answers
  1. Daniel
    Daniel avatar
    12 posts
    Member since:
    Jun 2010

    Posted 20 Jul 2010 Link to this post

    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. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 22 Jul 2010 Link to this post

    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
  3. Daniel
    Daniel avatar
    12 posts
    Member since:
    Jun 2010

    Posted 22 Jul 2010 Link to this post

    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.
Back to Top