catch SelectedIndexChanged event of Accordion control in ASP.NET AjaxToolkit
I have an Accordion control that is populated dynamically. I want to catch the event raised when a new pane is clicked on to open. I don't see the event at all in intelli-sense and when I code it by hand anyways I get errors.
Is there any way to catch this event?
The goal is to let a control in the masterpage that is holding the Accordion kno开发者_高级运维w when the Accordion has changed so it can update another control.
To handle the client-side selectedIndexChanged
event:
function pageLoad()
{
$find("accordionBehaviorID").add_selectedIndexChanged(
accordion_selectedIndexChanged);
}
function accordion_selectedIndexChanged(sender, args)
{
var oldIndex = args.get_oldIndex();
var newIndex = args.get_selectedIndex();
// Do something...
}
As usual, you can define and register the handler at the same time using an anonymous function:
function pageLoad()
{
$find("accordionBehaviorID").add_selectedIndexChanged(
function(sender, args) {
// Do something...
}
);
}
精彩评论