Opening RadWindow from RadWindow and onClientClose event

2 posts, 0 answers
  1. MarkSci
    MarkSci avatar
    16 posts
    Member since:
    Dec 2011

    Posted 27 Feb 2012 Link to this post

    Hi all,

    I have an aspx page with a windowmanager which contains 2 separate windows (window1 and window2). Window 2 is a lookup dialogue form containing values which the user can select to return values to the parent window. Both Windows can be opened directly from the aspx page.

    Window2 can also be opened from Window1. Originally I put a new windowmanager in Window1 but I realised that this was not correct because when window2 was opened from window1, it opened inside window1 (and was only partially visible and restricted to window 1's borders) which is not correct. So as per the documentation (http://www.telerik.com/help/aspnet-ajax/window-programming-opening-from-within-dialog.html) I use the aspx forms window manager to open window2 from window1.

    My problem is that I am using the onClientClose event for window2 to populate the aspx page with return values from window2. However I also need to populate window1 with return values from window2 when window2 is called from window1.

    Does anybody know how I can (and should) achieve this?

    Many Thanks

    Mark
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 29 Feb 2012 Link to this post

    Hello Mark,

    I have answered your support ticket on the same matter and I will copy my reply here as well in case someone else needs similar functionality:

    What I can suggest is that you start by examining this help article on calling functions in windows: http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html.

    Then, when calling window2 from window1 you can raise a global flag in the main aspx page (e.g. openedFromWithinDialog=true) which will be used in the OnClientClose handler of window2 - if true (its default value would be false) you will call a function inside window1 that will populate your values (you can pass them as an argument). This flag would need to be reset to false when you open window2 directly from the main aspx page, which is just one more line of code in the opener function. You could additionaly make sure that window1 is still opened when window2 is closed by first checking through the isVisible() method from its client-side API after you get a reference to it.


    All the best,
    Marin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top