Client Events in Accordion

Last post 03-27-2008 10:51 AM by DisturbedBuddha. 2 replies.

Sort Posts:

  • Client Events in Accordion

    03-26-2008, 5:42 PM
    • Loading...
    • CSeifert
    • Joined on 12-26-2006, 3:28 AM
    • Posts 13

    In reviewing the accordionbehavior.js file, I found an event that I want to handle in my page javascript.  I'm not sure of the systax to do this in javascript.

    Specifically, I want to handle the onHeaderClick event prior to the accordionbehavior.js file handling it. 

    Thanks in advance and please provide a snippit if possible.

  • Re: Client Events in Accordion

    03-26-2008, 7:46 PM
    Answer
    • Loading...
    • mrmercury
    • Joined on 04-04-2006, 2:26 PM
    • Mexico City, Mexico
    • Posts 270
    There’s not onHeaderClick event in the accordion, at least not one that you can use, it’s an internal function that gets called when the header gets clicked but the event doesn’t bubble up.
    If this post helped you please remember to set it as Answer so it can help others.
  • Re: Client Events in Accordion

    03-27-2008, 10:51 AM

    You can utilize the selectedIndexChanging event, which is fired whenever a header is clicked.  Just add a handler for that event: 

            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <script type="text/javascript">
                function pageLoad() {
                    var acc = $find('<%= Accordion1.ClientID %>_AccordionExtender');
                    acc.add_selectedIndexChanging(ClickHandler);
                }
                function ClickHandler() {
                    // Do whatever you want.
                    alert('Something is happening!');
                }
            </script>
            <cc1:Accordion ID="Accordion1" ... >
     
    When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


    My latest ASP.NET AJAX blog entries.
Page 1 of 1 (3 items)