Urgent Accordion Header Event

Last post 01-22-2009 9:13 AM by lunix11. 15 replies.

Sort Posts:

  • Urgent Accordion Header Event

    01-05-2009, 10:47 AM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    I need Urgent  help for Accordion Component.

    I want to user Accordion like a web site Menu for this I need to listen to the click event in the header section when I add an hyperlink.

    Can I override some method in the Accordion Class ?

    I havent find yet a solution can someone help me

  • Re: Urgent Accordion Header Event

    01-05-2009, 2:05 PM
    • Member
      222 point Member
    • TomKester
    • Member since 01-05-2009, 6:43 PM
    • Posts 64

    really, i'm a novice but i may be able to help you.

     You do need to be more specific though. Are you trying to put Links in the  Header  of your accordion?

    Please post me the code for your accordion along with a little more descriptive information about what you are trying to achieve..

     

    In the place I live in the only programmer i have to talk to is myself, no wonder people think i'm crazy.
  • Re: Urgent Accordion Header Event

    01-07-2009, 12:40 AM
    Hi lunix11,

    Set the property SuppressHeaderPostbacks with false, then any post back event in the Header can be fired.

    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Urgent Accordion Header Event

    01-07-2009, 11:11 AM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    thank you Zhi-Qiang Ni

    the problem that I'm using the Ajax extension for ASP.NET 2.0 and the SuppressHeaderPostbacks is not available in this version.

     

    thanks

     

     

  • Re: Urgent Accordion Header Event

    01-07-2009, 11:18 AM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    this is my code

     

    <cc1:Accordion ID="AccordionEng" runat="server"

    HeaderCssClass="accordionHeader"

    ContentCssClass="accordionContent"

    FadeTransitions="true"

    FramesPerSecond="40"

    TransitionDuration="250"

    AutoSize="Limit"

    SelectedIndex="0" CssClass="Acordion">

     

    <Panes>

     

     

    <cc1:AccordionPane ID="AccordionPaneHomeEng" runat="server">

    <Header>

     

    <a href = "~/Default.aspx"  style="color:White;"><b>&nbsp;&nbsp;&nbsp;Home</b></a>

    </Header>

     

    </cc1:AccordionPane>

     

     

    <cc1:AccordionPane ID="AccordionPaneProgDescripEng" runat="server">

    <Header>

     

     

    <a href = "~/WebPage/ProgramDescription/ProgramDescription.aspx"  style="color:White;"><b>&nbsp;&nbsp;&nbsp;PROGRAM DESCRIPTION</b></a>

     

    </Header>

    <Content>

     

    <asp:LinkButton ID="LinkButtonSteeringCommitEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/ProgramDescription/SteeringCommitteeMembers.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Steering Commitee</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonSelectionCriteriaEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/ProgramDescription/PatientSelectionCriteria.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Selection Criteria</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonProgramCompEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/ProgramDescription/ComponentsProgram.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Program Components</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonProgramStepsEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/ProgramDescription/ProgramSteps.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Program Steps</asp:LinkButton><br /> <br />

     

    </Content>

    </cc1:AccordionPane>

     

     

    <cc1:AccordionPane ID="AccordionPaneCoreCompEng" runat="server">

    <Header>

     

     

    <a href = "~/WebPage/CoreComponents/CoreComponents.aspx"  style="color:White;"><b>&nbsp;&nbsp;&nbsp;CORE COMPONENTS</b></a>

     

    </Header>

    <Content>

    <asp:LinkButton ID="LinkButtonUserInfoEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/CoreComponents/UserInformation.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User Information</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonPatientProEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/CoreComponents/PatientProfiles.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Patient Profiles</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonDataRepEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/CoreComponents/DataReport.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Data Report</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonProgramEvaEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/CoreComponents/ProgramEvaluation.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Program Evaluation</asp:LinkButton><br /> <br />

     

    </Content>

    </cc1:AccordionPane>

     

    <cc1:AccordionPane ID="AccordionPaneOptionCompEng" runat="server">

    <Header>

     

     

    <a href = "~/WebPage/OptionalComponents/OptionalComponets.aspx"  style="color:White;"><b>&nbsp;&nbsp;&nbsp;OPTIONAL COMPONENTS</b></a>

    </Header>

    <Content>

    <asp:LinkButton ID="LinkButtonPPREng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/OptionalComponents/RequestPPT.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PowerPoint Request</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonPresenEvaEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/OptionalComponents/PresenEvaluation.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Presentation Evaluation</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    <asp:LinkButton ID="LinkButtonCreditAppEng" ForeColor="#00a2c2" PostBackUrl="~/WebPage/OptionalComponents/CreditApplication.aspx" runat="server">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Credit Information</asp:LinkButton><hr align="center"width="150px" color="#666666" size="1" />

    </Content>

    </cc1:AccordionPane>

     

    <cc1:AccordionPane ID="AccordionPaneReferencesEng" runat="server">

    <Header>

     

     

    <a href = "~/WebPage/References/References.aspx"  style="color:White;"><b>&nbsp;&nbsp;&nbsp;REFERENCES</b></a>

     

    </Header>

    <Content>

     

    </Content>

    </cc1:AccordionPane>

     

     

    <cc1:AccordionPane ID="AccordionPaneResourcesEng" runat="server">

    <Header>

     

     

    <a href = "~/WebPage/Ressources/Resources.aspx"  style="color:White;"><b>&nbsp;&nbsp;&nbsp;RESOURCES</b></a>

    </Header>

    <Content>

    </Content>

    </cc1:AccordionPane>

     

     

     

     

     

    </Panes>

    </cc1:Accordion>

     

    in the header section I have links I want when I click to this links the content of the accordion collapse and the click event of the link will be fired to go to the link that is embed

  • Re: Urgent Accordion Header Event

    01-07-2009, 9:48 PM

    Hi lunix11,

    So, please update your AjaxControlToolkit to the latest version of VS2005.
    Version 1.0.20229
    You can also download the Toolkit for .NET Framework 2.0, ASP.NET AJAX 1.0 and Visual Studio 2005.

    Best regards,

    Zhi-Qiang Ni

     

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Urgent Accordion Header Event

    01-08-2009, 8:47 AM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    Hi Zhi-Qiang Ni,

     

    With this update I can use the supp option in the Accordion to fire link event in the header.

    thanks

  • Re: Urgent Accordion Header Event

    01-08-2009, 10:27 AM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    Hi,

     

    I have update the Ajax toolkit and now I'm able to fire the event in the header but the only problem now is that the there's no fade transition.

     can you have any idea how to keep it

     

    thanks

  • Re: Urgent Accordion Header Event

    01-09-2009, 1:38 AM
    Answer

    Hi lunix11,

    If we trigger the Service Event of the LinkButton inside the Accordion’s Header, the page would call a post back, then all the controls should be rendered again. Thus the behavior is indeed a update of the page with the new style of the AccordionPane, any client animation cannot be produced.

    To stay the Animation of the Accordion when the controls is call a post back, we need disable the Service Event at the first, add a event handler to the fade animation’s ended event, then call _doPostBack in the event handler.

    Here is my sample code:

    .aspx file 

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test1.aspx.vb" Inherits="SoluTest_Accordion.Test1"
        EnableEventValidation="false" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            .accordionHeader
            {
                border: 1px solid #2F4F4F;
                color: white;
                background-color: #2E4d7B;
                font-family: Arial, Sans-Serif;
                font-size: 12px;
                font-weight: bold;
                padding: 5px;
                margin-top: 5px;
                cursor: pointer;
                height: 10px;
            }
            .accordionHeaderSelect
            {
                border: 1px solid #2F4F4F;
                color: red;
                background-color: #2E4d7B;
                font-family: Arial, Sans-Serif;
                font-size: 12px;
                font-weight: bold;
                padding: 5px;
                margin-top: 5px;
                cursor: pointer;
                height: 10px;
            }
            .accordionContent
            {
                background-color: #D3DEEF;
                border: 1px dashed #2F4F4F;
                border-top: none;
                padding: 5px;
                padding-top: 10px;
            }
        </style>
    
        <script type="text/javascript">
            var accordion;
            var currentLink;
            function linkClientClick(id, link) {
                //To handle the animation ended event
                accordion._getAnimation(accordion._panes[id])._animations[0].add_ended(animationEndedHandler);
                //get the Link's uniqueID from the href
                a = link.href.replace("javascript:__doPostBack('", "");
                currentLink = a.substring(0, a.indexOf("'", 0));
            }
    
            function pageLoad() {
                accordion = $find("Accordion2_AccordionExtender");
                currentLink = null;
            }
    
            function animationEndedHandler() {
                if (currentLink) {
                    //do post back
                    __doPostBack(currentLink, '');
                }
            }
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <cc1:Accordion ID="Accordion2" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader"
                        HeaderSelectedCssClass="accordionHeaderSelect" ContentCssClass="accordionContent"
                        FadeTransitions="True" FramesPerSecond="40" TransitionDuration="1250" AutoSize="None"
                        RequireOpenedPane="false" SuppressHeaderPostbacks="false">
                        <Panes>
                            <cc1:AccordionPane ID="AccordionPane1" runat="server">
                                <Header>
                                    <p>
                                        Run fade animation before Link's service event is fired.</p>
                                    <asp:LinkButton ID="LinkButton1" OnClientClick="linkClientClick(0,this);return false;"
                                        runat="server">LinkButton1</asp:LinkButton><%-- return false to disable the server event--%>
                                </Header>
                                <Content>
                                    <p>
                                        This is the content area!</p>
                                </Content>
                            </cc1:AccordionPane>
                            <cc1:AccordionPane ID="AccordionPane2" runat="server">
                                <Header>
                                    <p>
                                        Click the LinkButton with no animation</p>
                                    <asp:LinkButton ID="LinkButton2" runat="server">LinkButton2</asp:LinkButton>
                                </Header>
                                <Content>
                                    <p>
                                        This is the content area!</p>
                                </Content>
                            </cc1:AccordionPane>
                        </Panes>
                    </cc1:Accordion>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    </html>
    .aspx.vb file 
    Public Partial Class Test1
        Inherits System.Web.UI.Page
    
        Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton1.Click
            LinkButton1.Text = "Link1 is clicked!"
        End Sub
    
        Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton2.Click
            LinkButton2.Text = "Link2 is clicked!"
        End Sub
    
    End Class
    Have my suggestion helped?

    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Urgent Accordion Header Event

    01-15-2009, 8:50 AM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    Hi Zhi-Qiang Ni,

    How are you I hope fine

    Excuse me for the delay I have something else to do.

     

    I have tried your sample but it dosen't work fine

     

    I have the same problem sometimes the fade works and sometimes the fade dosen't work

     

    Do you have any idea about this

     

  • Re: Urgent Accordion Header Event

    01-15-2009, 9:57 PM

    Hi lunix11,

    My last sample demonstrated how to dopostback after the Animation is ended. The LinkButton had no the PostBackUrl property. If you would like to let the LinkButton redirect the page to other URL. The key is find the LinkButton’s UniqueID from the Link’s href and then post back to another page at the server side.

    We know the UniqueID is always displayed as the first parameter of the LinkButton’s href.

    For example,
    Only Post Back 

    javascript:__doPostBack('ctl05$LinkButton2','')
    With PostBackURL 
    javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions("ctl03$LinkButton1",%20"",%20false,%20"",%20"Default.aspx",%20false,%20true))
    So, to find the UniqueID, this code is great: 
                //get the Link's uniqueID from the href
                var href = link.href;
                var startIndex;
                var endIndex;
                if (href.indexOf('"', 0) == -1) {
                    //the style of the href is javascript:__doPostBack('ctl05$LinkButton2','')
                    startIndex = href.indexOf("'", 0) + 1;
                    endIndex = href.indexOf("'", startIndex);
                } else {
                    //the style of the href is javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions("ctl03$LinkButton1",%20"",%20false,%20"",%20"Default.aspx",%20false,%20true))
                    startIndex = href.indexOf('"', 0) + 1;
                    endIndex = href.indexOf('"', startIndex);
                }
    
                currentLink = href.substring(startIndex, endIndex);
     Now, let’s finish the solution. Please refer to my code here:

    .aspx file 

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test1.aspx.vb" Inherits="SoluTest_Accordion.Test1"
        EnableEventValidation="false" %>
    
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            .accordionHeader
            {
                border: 1px solid #2F4F4F;
                color: white;
                background-color: #2E4d7B;
                font-family: Arial, Sans-Serif;
                font-size: 12px;
                font-weight: bold;
                padding: 5px;
                margin-top: 5px;
                cursor: pointer;
                height: 10px;
            }
            .accordionHeaderSelect
            {
                border: 1px solid #2F4F4F;
                color: red;
                background-color: #2E4d7B;
                font-family: Arial, Sans-Serif;
                font-size: 12px;
                font-weight: bold;
                padding: 5px;
                margin-top: 5px;
                cursor: pointer;
                height: 10px;
            }
            .accordionContent
            {
                background-color: #D3DEEF;
                border: 1px dashed #2F4F4F;
                border-top: none;
                padding: 5px;
                padding-top: 10px;
            }
        </style>
    
        <script type="text/javascript">
            var accordion;
            var currentLink;
            function linkClientClick(paneIndex, link) {
                //To handle the animation ended event
                accordion._getAnimation(accordion._panes[paneIndex])._animations[0].add_ended(animationEndedHandler);
    
                //get the Link's uniqueID from the href
                var href = link.href;
                var startIndex;
                var endIndex;
                if (href.indexOf('"', 0) == -1) {
                    //the style of the href is javascript:__doPostBack('ctl05$LinkButton2','')
                    startIndex = href.indexOf("'", 0) + 1;
                    endIndex = href.indexOf("'", startIndex);
                } else {
                    //the style of the href is javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions("ctl03$LinkButton1",%20"",%20false,%20"",%20"Default.aspx",%20false,%20true))
                    startIndex = href.indexOf('"', 0) + 1;
                    endIndex = href.indexOf('"', startIndex);
                }
    
                currentLink = href.substring(startIndex, endIndex);
            }
    
            function pageLoad() {
                accordion = $find("Accordion2_AccordionExtender");
                currentLink = null;
            }
    
            function animationEndedHandler() {
                if (currentLink) {
                    //do post back
                    __doPostBack(currentLink, '');
                }
            }
        </script>
    
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <cc1:Accordion ID="Accordion2" runat="server" SelectedIndex="0" HeaderCssClass="accordionHeader"
                        HeaderSelectedCssClass="accordionHeaderSelect" ContentCssClass="accordionContent"
                        FadeTransitions="True" FramesPerSecond="40" TransitionDuration="1250" AutoSize="None"
                        RequireOpenedPane="false" SuppressHeaderPostbacks="false">
                        <Panes>
                            <cc1:AccordionPane ID="AccordionPane1" runat="server">
                                <Header>
                                    <p>
                                        Run fade animation before Link's service event is fired.</p>
                                    <asp:LinkButton ID="LinkButton1" PostBackUrl="~/Default.aspx" OnClientClick="linkClientClick(0,this);return false;"
                                        runat="server">LinkButton1</asp:LinkButton>
                                    <%-- return false to disable the server event--%>
                                    <%--Notice that the paneIndex is 0--%>
                                </Header>
                                <Content>
                                    <p>
                                        This is the content area!</p>
                                </Content>
                            </cc1:AccordionPane>
                            <cc1:AccordionPane ID="AccordionPane2" runat="server">
                                <Header>
                                    <p>
                                        Click the LinkButton with animation but no redirection</p>
                                    <asp:LinkButton ID="LinkButton2" runat="server" OnClientClick="linkClientClick(1,this);return false;">LinkButton2</asp:LinkButton>
                                    <%--Notice that the paneIndex is 1--%>
                                </Header>
                                <Content>
                                    <p>
                                        This is the content area!</p>
                                </Content>
                            </cc1:AccordionPane>
                            <cc1:AccordionPane ID="AccordionPane3" runat="server">
                                <Header>
                                    <p>
                                        Click the LinkButton with redirection but no animation</p>
                                    <asp:LinkButton ID="LinkButton3" PostBackUrl="~/Default.aspx" runat="server">LinkButton3</asp:LinkButton>
                                </Header>
                                <Content>
                                    <p>
                                        This is the content area!</p>
                                </Content>
                            </cc1:AccordionPane>
                        </Panes>
                    </cc1:Accordion>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
        </form>
    </body>
    </html>
    .aspx.vb file 
    Public Partial Class Test1
        Inherits System.Web.UI.Page
    
        Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton1.Click
    
            Response.Redirect("Default.aspx")
            'LinkButton1.Text = "Link1 is clicked!"
        End Sub
    
        Protected Sub LinkButton2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton2.Click
            LinkButton2.Text = "Link2 is clicked!"
        End Sub
    
    End Class
    Have my suggestion helped?

    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Urgent Accordion Header Event

    01-20-2009, 5:11 PM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    Hi Zhi-Qiang Ni,

     

    I want to ask you about somethingthat make me crazy.

     

    I have upgrade my Ajax toolkit to have to supp option in the acordion.

     

    Now when I click to my linkbutton in the header the event is fired and I reach the page that I want but no collapse is made.

    how I can do in order that when I click to the linkbutton in the header I can go to the page that I want and my accordion make collapse to show his child

     

    it's urgent for me

    thanks a lot

  • Re: Urgent Accordion Header Event

    01-21-2009, 3:36 AM
    Answer

    Hi lunix11,

    To stay the selection of the AccorionExtender after the page is reloaded, we need keep the selected index inside the cookie.

    Please modify my client script code as this: 

            var accordion;
            var currentLink;
            function linkClientClick(paneIndex, link) {
                //To handle the animation ended event
                accordion._getAnimation(accordion._panes[paneIndex])._animations[0].add_ended(animationEndedHandler);
    
                //get the Link's uniqueID from the href
                var href = link.href;
                var startIndex;
                var endIndex;
                if (href.indexOf('"', 0) == -1) {
                    //the style of the href is javascript:__doPostBack('ctl05$LinkButton2','')
                    startIndex = href.indexOf("'", 0) + 1;
                    endIndex = href.indexOf("'", startIndex);
                } else {
                    //the style of the href is javascript:WebForm_DoPostBackWithOptions(new%20WebForm_PostBackOptions("ctl03$LinkButton1",%20"",%20false,%20"",%20"Default.aspx",%20false,%20true))
                    startIndex = href.indexOf('"', 0) + 1;
                    endIndex = href.indexOf('"', startIndex);
                }
    
                currentLink = href.substring(startIndex, endIndex);
            }
    
            function pageLoad() {
                accordion = $find("Accordion2_AccordionExtender");
                currentLink = null;
                if (getCookie()) {
                    accordion.set_SelectedIndex(getCookie());
                }
            }
    
            function animationEndedHandler() {
                setCookie(accordion.get_SelectedIndex());
                if (currentLink) {
                    //do post back
                    __doPostBack(currentLink, '');
                }
            }
    
            function pageUnload() {
                setCookie(accordion.get_SelectedIndex());
            }
    
            function setCookie(cookieValue) {
                sVar = "selectedIndex";
                //the expiration time 
                var date = new Date();
                date.setTime(new Date().getTime() + (60 * 60 * 1000));
                theCookie = sVar + '=' + cookieValue + '; expires=' + date.toGMTString();
                document.cookie = theCookie;
            }
    
            function getCookie() {
                sVar = "selectedIndex";
                cookies = document.cookie.split('; ');
                for (var i = 1; i <= cookies.length; i++) {
                    if (cookies[i - 1].split('=')[0] == sVar) {
                        return cookies[i - 1].split('=')[1];
                    }
                }
            }
    You can change the expiration time of the cookie by yourself.

    Have my code helped?

    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
  • Re: Urgent Accordion Header Event

    01-21-2009, 4:32 PM
    • Member
      8 point Member
    • lunix11
    • Member since 12-19-2008, 11:37 AM
    • Posts 20

    Hi Zhi-Qiang Ni

     

    thank you for your answer. But I think that you haven't understand what I mean.

    The problem is how the content panel is opend and closed is good like the original when I click to the header.

     

    can you have any idea

     

    thanks

     

     

  • Re: Urgent Accordion Header Event

    01-21-2009, 9:18 PM

    Hi lunix11,

    I still can’t understand your word about “The problem is how the content panel is opend and closed is good like the original when I click to the header.”. If you use the LinkButton to redirect to another page, the new page would be opened after the collapse/expand animation. That’s what my code implemented.

    I need your detail description about all the flow actions, for example, click the header, expand the pane… and so on.

    Best regards,

    Zhi-Qiang Ni

    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as
    Answer” if a marked post does not actually answer your question.
Page 1 of 2 (16 items) 1 2 Next >