开发者

Registering JavaScript handler function to handle CollapsiblePanelExtender event

I checked my html page generated by asp.net and I can see this line

Sys.Application.initialize();
Sys.Application.add_init(function() {
    $create(AjaxControlToolkit.CollapsiblePanelBehavior,
    {
        "ClientStateFieldID":"rptActiveQuotes_ctl01_qcQuote_cpeDetails_ClientState",
        "CollapseControlID":"rptActiveQuotes_ctl01_qcQuote_imgShowHide",
        "Collapsed":true,
        "CollapsedImage":"Images/expandablePlus.gif",
        "ExpandControlID":"rptActiveQuotes_ctl01_qcQuote_imgShowHide",
        "ExpandedImage":"Images/expandableMinus.gif",
        "ImageControlID":"rptActiveQuotes_ctl01_qcQuote_imgShowHide",
        "id":"rptActiveQuotes_ctl01_qcQuote_cpeDetails"
    }, 
    null, 
    null, 
    $get("rptActiveQuotes_ctl01_qcQuote_pDetails"));
}); 

I think it's generated f开发者_Python百科rom CollapsiblePanelExtender with name cpeDetails. And I see you can pass number of events to it, which is now null (third argument). What should I do to set add_ended event there?


AJAX controls/extenders have a bunch of OnClient properties,which you assign the name of a method as the handler as in OnClientClicked="funcname". You can define that on the server, and it gets wired up on the client. You can also register an event handler on the client to, as in:

var o = $find("<%= cpeDetails.ClientID %>");
o.add_<event>(function(sender, e) 
   //event handler code
});

So you could do o.add_ended(function() { /* handler */ }). Is there an ended event? I don't recall that being an option...

HTH.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜