locked
AccordianPane Header and Content properties RRS feed

  • Question

  • User-2020087258 posted

    I am using the AjaxControlToolkit Accordian and during a postback I need to view the text/html of the header and content properties within each AccordianPane.  So far, all attempts to do this have failed.  Is this doable?

    thanks

    Wednesday, June 18, 2014 12:16 PM

Answers

  • User1918509225 posted

    Hi sbland,

    If you want to view the text/html of  the header and content properties  with each accordianPane

    You can try the code  below:

     <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
        <div>
            <ajaxToolkit:Accordion ID="Accordion1" runat="server">
                <Panes>
                    <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
                        <Header>Panel1</Header>
                        <Content>1111111111111111111</Content>
                    </ajaxToolkit:AccordionPane>
                    <ajaxToolkit:AccordionPane ID="AccordionPane2" runat="server">
                        <Header>Panel2</Header>
                        <Content>22222222222222222222222</Content>
                    </ajaxToolkit:AccordionPane>
                    <ajaxToolkit:AccordionPane ID="AccordionPane3" runat="server">
                         <Header>Panel3</Header>
                        <Content>33333333333333333333333</Content>
                    </ajaxToolkit:AccordionPane>
                </Panes>
            </ajaxToolkit:Accordion>
        </div>
            <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>
     protected void Button1_Click(object sender, EventArgs e)
            {
                foreach (AccordionPane accPane in Accordion1.Panes)
                {
                    LiteralControl headerText = (LiteralControl)accPane.HeaderContainer.Controls[0];
                    string header = headerText.Text;
                    LiteralControl contentText = (LiteralControl)accPane.ContentContainer.Controls[0];
                    string content = contentText.Text;
                }
            }

    If you AccordionPane contains control like button,you can try the link below:

    http://forums.asp.net/t/1754389.aspx?Get+the+Value+of+Controls+in+a+Ajax+Accordion

    Best Regards,

    Kevin Shen.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, June 19, 2014 2:00 AM

All replies