Opening multiple RadWindow popups

5 posts, 0 answers
  1. Tejas
    Tejas avatar
    31 posts
    Member since:
    Mar 2011

    Posted 07 Jun 2011 Link to this post

    Hi,
    I want to open a multiple RadWindows from my page one after the other. How can I do it ?

    For example: I have login.aspx page with "Forget Password ?" link.
    When user click that link, I want to open recover password Model pop-up which is radwindow and the page is recoverpassword.aspx. Once user can specify require details and entered detail is correct then I have to close the "recover password" pop-up which is recoverpassword.aspx page, then I want to open "security question" pop-up which is my SecurityQuestion.aspx. If user provide correct data for question then I want to close that pop-up Radwindow which is my SecurityQuestion.aspx after performing some operation.
    In these operations, I dont want to refresh my login.aspx page.

    Any help ?

    Thanks

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    2626 posts
    Member since:
    Jun 2013

    Posted 08 Jun 2011 Link to this post

    Hi Tejas,

    There are a two approaches you can take:

    1) when the respective button (OK or Send for example) within the RadWindow is opened you can get a reference to the RadWindow and change its Url so that the next page is loaded inside. This way you will be using only one RadWindow. For more information on the available methods and the way to get a reference to the RadWindow from within its content page please examine the following articles:

    2) you can get a reference to the browser window and open a new RadWIndow from there via JavaScript:

    First get a reference to the window as described in the first article, then call the function from the main window (accessing it via the BrowserWindow property) that will open the second popup and then in the same button handler call the first window's close() method. The same procedure can be repeated for the second - click the button, get the reference, call the close method. For more information on calling a function from the main page please see the following article: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html.

    On the ways to open a RadWindow please see this page: http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html.

    For your convenience I created and attached a small sample that shows these suggestions in action.

    I hope my reply was helpful.



    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.

  3. Tejas
    Tejas avatar
    31 posts
    Member since:
    Mar 2011

    Posted 08 Jun 2011 Link to this post

    Hi Marin,

    Thanks for the reply and providing demo. It works fine.
    But unfortunately, I want to close the popups (both RadWindows) from server side after performing some action and not at the client side.
    Right now, It does not reach to my server event of button click.

    In addition, while using same window and changing just URL, I found that once close the second window and try to open windows again redirects me to the second window instead of the first window, URL resetting problem.

    Any suggestion ?

    Thanks

  4. Marin Bratanov
    Admin
    Marin Bratanov avatar
    2626 posts
    Member since:
    Jun 2013

    Posted 09 Jun 2011 Link to this post

    Hello Tejas,

    You stated that you do not want to refresh the parent page and this is why I used only JavaScript to do the necessary (thus cancelling the postbacks). If you wish to have server-side handlers for the buttons you can simply move the functionality you wish to the server side and after that inject a JavaScript call to the function that closes the RadWindow (the OpenNextWindow() and closeMe() respectively). How to do that is explained in the following blog post: http://blogs.telerik.com/supportdept/posts/09-05-05/executing_javascript_function_from_server-side_code.aspx. In short the syntax you need is similar to this:

    string script = "function f(){OpenNextWindow();Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
    ScriptManager.RegisterStartupScript(this, this.GetType(), "key", script, true);

    Please note that you need a script manager on the page in order for this event to be available.

    As for the URL - the setUrl() method changes the NavigateUrl of the RadWindow and this is the expected behavior. If you wish to use one window you can simply call this method when you show it for the first time (from the main page in the openFirstWindow() function) to force the desired url to be the first loaded every time.



    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.

  5. Tejas
    Tejas avatar
    31 posts
    Member since:
    Mar 2011

    Posted 13 Jun 2011 Link to this post

    Hi Marin,

    Thanks for this solution. It works fine for me now !!!

    Thanks again :)


Back to Top