Registering a RadWindow with a RadWindowManager on the fly

3 posts, 0 answers
  1. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 28 Aug 2012 Link to this post

    I imagine that that title has a couple of you almost automatically reaching for your keyboards to type a reply.

    Read on.

    I have a control that, under certain conditions, needs to open a window to collect additional info from the user. Lets call the control the "SettingsControl" and the window that it opens the "AdvancedWindow".

    The SettingsControl will be deployed in any number of pages which, themselves are displayed in a RadWindow. Let's call these the "CallingPages" and the underlying aspx page that drives it all, the "TopLevelPage"

    My CallingPages directly manipulate controls on (and handle events from) the AdvancedWindow which is defined inside the SettingsControl using a ContentTemplate.

    My problem is that when I open the AdvancedWindow it is limited in dimensions to the window containing the SettingsControl.

    Now, normally, my AdvancedWindow would be defined using a completely separate aspx page and the window would be opened by having it registered with the WindowManager on the TopLevelPage. Clearly, in this specific case I can't.

    What I need to be able to do is something like this...

    1. When the CallingPage opens it has a reference to the RadWindowManager that opened it.
    2. The CallingPage notifies the SettingsControl and it, in turn, registers the AdvancedWindow with the RadWindowManager from the previous step so that, when called, it has the entire browser window to wander about in.

    I can get a reference to the RadWindowManager that opens a RadWindow but only client-side. Because I can't 'see' the active window manager I can't add my AdvanceWindow to its 'Windows' collection and there is no method for doing this client-side.

    So, questions:
    1. Is it p[ossible to do what I'm aiming for?
    2. If not, is there a reasonable alternative method?

    It is important that my CallingPages can both get/set properties in the AdvancedWindow (which I could do with QueryString parameters and return arguments) and respond to events from controls in the AdvancedWindow. As an example,. the AdvancedWindow contains a RadListView and I need the CallingPages to handle the OnNeedDataSource event.

    I'd be grateful for any help/suggestions.

    --
    Stuart

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 30 Aug 2012 Link to this post

    Hi Stuart,

    I am not sure I completely understand the case, but it seems like there are two requirements that exclude each other
    - the AdvancedWindow uses the ContentTemplate and server events from controls inside are handled in the code-behind of the SettingsControl. This SettingsControl is in a CallingPage, i.e. in an iframe, therefore limited inside this frame
    - in order to have the AdvancedWindow move in the entire viewport we must move it to the top level page, which in turn changes its context - it cannot be in the SettingsControl in the CallingPage

    If I have understood the case correctly then I'm afraid there isn't an option to have both. What you could do is to keep the necessary information in the Session and use an entire aspx page for the AdvancedWindow - have its code-behind access the data you stored in the Session in the SettingsControl, then you can also store the user's input there and read it back in the control when the RadWindow is closed. You could also pass querystring paramters to the page if it would help you. By using this approach you can simply radopen() a new RadWindow from the top level page.

    You can also keep a reference to the window object of the calling page when you open the AdvancedWindow (see the last snippet - the manager.open() returns a reference to the RadWindow, so you can create a field in it, something like oWnd.callingPageReference = window;). This will allow you to call JS functions in it according to your events (instead of oWnd.BrowserWindow.calledFn() do oWnd. callingPageReference.calledFn(arguments)). This may also help you somehow, I hope.

    This may just be confirming your view of the situation. If I have misunderstood something and the limitations I listed above are not the same could you try explaining them in a simpler manner so I can grasp them better and see if I can come up with another idea?


    Greetings,
    Marin Bratanov
    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
  4. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 30 Aug 2012 Link to this post

    Marin, You're right. I've explored a number of options and I've gon back to handling the data via the Session. -- Stuart
Back to Top