This is a migrated thread and some comments may be shown as answers.

What event should I capture for client-side initialization?

3 Answers 86 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 13 Jun 2011, 06:27 PM
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?

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 14 Jun 2011, 05:57 AM
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.
0
Jeff
Top achievements
Rank 1
answered on 14 Jun 2011, 04:10 PM
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.
0
Dathan
Top achievements
Rank 1
answered on 03 Dec 2012, 10:49 PM
Did you find an answer?
Tags
General Discussions
Asked by
Jeff
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jeff
Top achievements
Rank 1
Dathan
Top achievements
Rank 1
Share this question
or