In the ListSearchExtender which I am currently working to contribute to the AJAX Control Toolkit I use the PopupBehavior to display a DIV next to the ListBox (rendered as a SELECT) which initially has a message such as “Type to search…”. This is then replaced as the user types characters, with the characters they have typed.
If the user sets the ListBox to have the default focus (via the form’s defaultFocus property) then I want to show the Prompt DIV immediately, which I initially tried doing in my control extender’s initialize method. This didn’t work, and the reason is that there is a second initialization pass that takes place for the PopupBehavior, that is called by the framework, which hides the element (my DIV) associated with the PopupBehavior. This second pass takes place after my extender’s initialize method is called.
The workaround I used was to register a method to be called after all controls are initialized. That would be the Sys.Application.load method:
this._applicationLoadDelegate = Function.createDelegate(this, this._onApplicationLoad);
My delegate gets called after all scripts have been loaded and the objects in the application have been created and initialized.