开发者

catch SelectedIndexChanged event of Accordion control in ASP.NET AjaxToolkit

开发者 https://www.devze.com 2023-01-21 09:09 出处:网络
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

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...
        }
    );
}
0

精彩评论

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

关注公众号