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

Error/Login page appearing in RadWindow

3 Answers 67 Views
Window
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 12 Apr 2011, 03:58 AM
Hello,

We use radwindows in several places in our application.  Errors cause a redirect either to our login page or to an error page.  Most common is due to session timeout. 

It is a problem when this happens while the user is in a radwindow and the radwindow itself displays the login page.   We have fixed this for IE by placing this javascript on our login page:

 

<script type="text/javascript">
        if (window != window.top) window.top.navigate(window.location.href);
</script>

This doesn't work on Mozilla.  This may be because mozilla creates each window on a seperate thread and thinks that the radwindow IS the top window?

Can you please advise how we can handle this issue.

Thanks

3 Answers, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 13 Apr 2011, 03:38 PM

Hi Michael,

I am not sure what your exact scenario is, but to manipulate the parent window you first need to get a reference to it. RadWindow offers a user-friendly API that enables you to easily achieve that - its BrowserWindow property.

For your convenience I created and attached a small sample that redirects the browser window upon a click of a button (you can use the same logic, just call the function when appropriate in your custom scenario). To get the URL of the RadWindow you can use its get_navigateUrl() method.



Kind regards,
Marin
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.

0
Michael
Top achievements
Rank 1
answered on 13 Apr 2011, 07:56 PM
Hello Marin,

Thank you for the assistance.  Again the issue is when a session had expired and the user opens a rad window and finds the login page inside the rad window.  I am attempting to have them redirect with the main window.

Thank you for the code sample.   I have to run the code at the start of the page to see if the  window that got there was a radwindow or the main browser window.  When I would navigate to the login page normally it would give me errors that radWindow is undefined or null.

I made some modifications do the code you provided that seems to work but I'm not at all good with javascript and can you advise if this is a good solution.  I left my previous code there commented out.

Thank you


<script type="text/javascript">
    //if (window != window.top) window.top.navigate(window.location.href);
    var oWindow = null;
    if ("radWindow" in window)
        oWindow = window.radWindow;
    else if (window.frameElement != null) {
        if ("radWindow" in window.frameElement) {
            oWindow = window.frameElement.radWindow;
        }
    }
    if (oWindow != null) {
        oWindow.BrowserWindow.location = '<%= Page.ResolveUrl(Paths.Login) %>';
    }
</script>
0
Marin Bratanov
Telerik team
answered on 15 Apr 2011, 09:05 AM

Hi Michael,

If I understand you scenario correctly this JavaScript function is run when the login page is opened. If so this seems to be a good check whether the user has been redirected within a RadWindow or within the browser window.

Without your actual logic I cannot confirm if this will always produce the desired result, but based on the provided information it seems as a good solution.

I hope your project is going well. If you have further issues with our controls do not hesitate to contact us again.



All the best,
Marin
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.

Tags
Window
Asked by
Michael
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Michael
Top achievements
Rank 1
Share this question
or