Client-side constructor

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

    Posted 16 Nov 2011 Link to this post

    Q1: Is it possible to create a RadWindow from scratch client-side? That is to say, is there a client-side constructor that I can invoke?

    Q2: If I've closed a window with DestroyOnClose = true, is it possible to gain access to the settings used in the mark-up to reconfigure the window if I need to reopen it?

    -- 
    Stuart
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 16 Nov 2011 Link to this post

    Hello Stuart,

    The answer to your first question is a YES - this is one of the main features of the RadWindowManager. Please examine the following help article on the matter:
    http://www.telerik.com/help/aspnet-ajax/window-programming-opening.html
    and more precisely the second section that describes the parameters of the open() method (which is essentially the same as radopen() function). Generally a RadWindow's UI is created on the fly via JavaScript (we call it lazy initialization) so that less markup is sent from the server. Such dynamic creation is best combined with the DestroyOnClose property being set to true as it removes the DOM elements when you close the RadWindow thus improving performance.

    On your second question - such information is no longer available once the client-side object of the RadWindow is destroyed. You could access the Windows collection of the RadWindowManager on the server and read the properties you need, though, yet this is rather difficult and requires a round-trip to the server. For windows you expect to need to reopen I advise that you explicitly set the DestroyOnClose property to false so that it overrides the global setting from the manager.


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

    Posted 16 Nov 2011 Link to this post

    Martin,

    > For windows you expect to need to reopen I advise that you explicitly set
    > the DestroyOnClose property to false so that it overrides the global setting
    > from the manager.

    The reason I'm looking in to this is that we have an app that uses RadWindows a lot and many of them fire the OnLoad event twice when reloaded, and many of them on PostBack too. And whilst destroying the window won;t solve the PostBack issue, it will solve the .show() one

    We noticed that if we recreated the Windows programmatically after destroying them, we saw less of this behaviour. What I'm trying to do is find a way of destroying the window but not having to round trip to the server if we need to display it again.

    I suppose another option might be to wire-up the OnClientClose client-side event and call the .set_url() method to point to something like "about:blank". It'd mean making sure that we called .set_url() again on show, but that'd be no biggie.

    --
    Stuart
  5. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 16 Nov 2011 Link to this post

    >  the second section that describes the parameters of the open()
    Doh!

    Of course. I sat starting at the docs looking for an explicitly defined constructor on the RawWindow client object page.

    Sometimes, I think I shouldn't be allowed out without a responsible adult!

    --
    STuart

  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 17 Nov 2011 Link to this post

    Hello Stuart,

    You can also preset the most common properties in the manager so that new windows are opened with them (size, behaviors, etc.). Another option is to store the old values in the OnClientBeforeClose event and apply them again after opening the new window if need be.

    I am not sure what your issue with double page loads is, as this has been fixed a couple of years ago, yet if setting the url to about:blank in the OnClientClose event works for you then it is an acceptable solution.


    Best regards,
    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
  7. Stuart Hemming
    Stuart Hemming avatar
    1622 posts
    Member since:
    Jul 2004

    Posted 18 Nov 2011 Link to this post

    Marin (Sorry I called you "Martin" last time)

    The issue with double page loading has been on our bug list for as long as I can remember and I'm (fairly) sure that it's still happening, but I'll check.

    As for the idea of saving the values in the OnClientClose event, I quite like that and so will spend a little time playing with it.

    Thanks for the input.

    -- 
    Stuart
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017