What event should I capture for client-side initialization?

4 posts, 0 answers
  1. Jeff
    Jeff avatar
    100 posts
    Member since:
    Apr 2008

    Posted 13 Jun 2011 Link to this post

    I'm trying to do some client-side initialization that involves calling $find() on the ClientID of some RadComboBoxes.

    My code is being run from an event-handler hooked to window load:

    Sys.UI.DomEvent.addHandler(window, 'load',
        function()
        {
            // My initialization stuff
        }
    );

    When this code, $find(clientid) returns null.

    If I move my initialization code to a window.setTimeout(), $find() works fine.  So clearly the only problem is that the client-side code hasn't been initialized, when the window load handler executes.

    When I browse the forums, I see recommendations to put the initialization code in a pageLoad().  Given the organization of the code in this project, that's not possible. (There can only be one pageLoad() function on a page - we have separate initialization functions for multiple user controls that may be included on a single page.  We'd like to keep the initialization for each encapsulated inside the control, we don't want to pull all the initialization into a single page-level function.)

    Are there any of the standard events that we can catch with Sys.UI.DomEvent to which we can add handlers that will fire after the telerik controls have been initialized?

  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 14 Jun 2011 Link to this post

    Hello Jeff,

    The RadComboBox having the client side event OnClientLoad which will fires after the combobox has been fully initialized on the client-side..

    You could find more information from the following help documentation.
    OnClientLoad.

    Thanks,
    Shinu.
  3. Jeff
    Jeff avatar
    100 posts
    Member since:
    Apr 2008

    Posted 14 Jun 2011 Link to this post

    That's not quite what I'm looking for.

    I'm trying to initialize a class that shouldn't be initialized until after all of the Telerik controls have been constructed.

    Someone pointed me to Sys.Application.add_load(handler), and that's more what I was looking for.
  4. Dathan
    Dathan avatar
    4 posts
    Member since:
    Nov 2007

    Posted 03 Dec 2012 Link to this post

    Did you find an answer?
Back to Top