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?


    Wednesday, June 18, 2014 12:16 PM


  • 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>
            <ajaxToolkit:Accordion ID="Accordion1" runat="server">
                    <ajaxToolkit:AccordionPane ID="AccordionPane1" runat="server">
                    <ajaxToolkit:AccordionPane ID="AccordionPane2" runat="server">
                    <ajaxToolkit:AccordionPane ID="AccordionPane3" runat="server">
            <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:


    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