Get name of parent page

2 posts, 0 answers
  1. Ajay
    Ajay avatar
    42 posts
    Member since:
    Jul 2010

    Posted 09 May 2011 Link to this post

    Hi,

    I have a page which opens a radwindow and this page in radwindow further opens another radwindow recursively inside one another.

    Now after navigating to the multiple level I need the name/path of the Parent page which caused the sequential load of windows.

    The use of sending the data between parent/child will not work as some of the calls are made using static href links.

    Also is there any way of restricting the number of windows that can be opened inside each other recursively?
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 12 May 2011 Link to this post

    Hello Ajay,

    I am not quite sure what exactly do you mean by "The use of sending the data between parent/child will not work as some of the calls are made using static href links.", but the functionality that you are looking for, can easily be achieved with some JavaScript.
    The main points in such approach are:
    1. In JavaScript, you could always get a reference to the topmost page (i.e. the one directly opened in the browser), by using the top property. You can use this fact, to build the logic that will limit the total number of RadWindows that can be opened.
    2. While inside a content page that is shown in a RadWIndow, you can get a reference to that RadWindow, by using the GetRadWindow() function. Once you have access to the RadWIndow object, you can get the parent page as well, by using the BrowserWIndow property from RadWindow's API. From this point on, just get the location.href property of the parent window, and you'll get its Url
    e.g.
    function checkParent()
    {
        var oWnd = GetRadWindow();
        var parentPage = oWnd.BrowserWindow;
        alert(parentPage.location.href);
    }

    I created a simple demo that you can use as a base for your implementation. In it, I limit the maximum number of opened RadWindows to 5 and I get the parent page's Url by using the function shown above.
    Please check the demo's code for more details.


    Kind regards,
    Georgi Tunev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top