Wednesday, March 28, 2012

Accessing control extender behaviors in javascript

Hi there,

I'm using the AJAX 1.0 Beta 2 extensions and the AjaxControlToolkit. I'm finding it extremely hard to access the behaviors associated with a given control. (I'd like to hook into the expandComplete event of an CollapsiblePanel).

I've tried using the following:

var cp = $get('IdOfMyCollapsiblePanel');
cp.get_behaviors()[0].add_expandComplete(MyHandlerFunction);

This results in an error with the get_behaviors() call.

Can anyone post an example of how to hook up a javascript method to an extenders event? (client-side)

I'd really appreciate it!

Jeremy

And here I go replying to myself...

I found the source of my problem. I was trying to set up the event handling in the pageLoaded event that is raised by the PageRequestManager, but the behaviors are not yet loaded at this time. Instead I hooked the Sys.Application.load event and everything works!

Jeremy

No comments:

Post a Comment