Asp.net AJAX Nested Accordian

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • somtabu
    New Member
    • Nov 2006
    • 15

    Asp.net AJAX Nested Accordian

    Hello... I want to make nested accordian with the help of AJAX ACCORDIAN control. Please help...... Thank you.
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    At least give it a try

    The Bytes volunteers are not here to write your code for you.
    Bytes is very much a "Give me a fish I eat for a day. Teach me to fish I eat for a lifetime" kind of place. Just giving you the code doesn't help you learn near as effectively as good old-fashioned trial and error.

    Do a little reading up and experimenting then if your trials aren't doing what you expect, post the code and relevant messages/errors and we'll see what we can do to point you in the right direction for making it work.

    Try hitting Google with terms of your programming language and primary terms of what you want to do. For example "C# custom events" or "VB datagrid Excel". I've found this to be a very effective tool.

    You need to take it upon yourself to
    • First: Do some research. I heard about thing thing called Google, or books even.
    • Second: Do some experiments yourself. You will learn so much from actually trying it before throwing up your hands in defeat before even starting.
    • Third: Show the volunteers here the code that you created that was the closest to successful along with relevant errors.

    Comment

    • Frinavale
      Recognized Expert Expert
      • Oct 2006
      • 9749

      #3
      You may want to check out the AjaxControlTool kit Accordion Examples and Documentation for help first.

      If you run into problems after trying to accomplish what you're trying to do, feel free to post about your specific issue.

      -Frinny

      Comment

      • thereporter
        New Member
        • Feb 2015
        • 1

        #4
        Nested accordions

        I need to do a similar thing, but I'm new to accordions and fairly new to C# and i'm having problems. I'm trying to dynamically add a pane to an accordion and the pane is to contain an accordion. It's not appearing as an accordion though. Any help would be great.

        My aspx:
        Code:
                No Of Projects: <asp:TextBox ID="numberOfProjects" runat="server" ontextchanged="numberOfProjects_TextChanged" AutoPostBack="true"></asp:TextBox>
        
                <asp:Accordion ID="projects" runat="server" AutoSize="None" SelectedIndex="0">
                    <Panes>
                        <asp:AccordionPane ID="project1" runat="server">
                            <Header>Project 1</Header>
                            <Content>
                                <asp:Accordion ID="project1Units" CssClass="accordion" HeaderCssClass="accordionHeader"
                                    HeaderSelectedCssClass="accordionHeaderSelected" ContentCssClass="accordionContent"
                                    runat="server" AutoSize="None" SelectedIndex="0" RequireOpenedPane="false">
                                    <Panes>
                                        <asp:AccordionPane ID="project1Unit1" runat="server">
                                            <Header>Project 1/Unit 1</Header>
                                            <Content>
                                                Unit Ref: <asp:TextBox ID="project1Unit1UnitRef" runat="server"></asp:TextBox>
                                            </Content>
                                        </asp:AccordionPane>
                                   </Panes>
                                </asp:Accordion>         
                            </Content>
                        </asp:AccordionPane>
                   </Panes>
                </asp:Accordion>         
        
        My code behind:
                Int32 number = Convert.ToInt32(numberOfProjects.Text);
                if (number > 1)
                {
                    for (int i = 1; i < number; i++)
                    {
                        string headerText = "Project " + Convert.ToString(i + 1);
                        AjaxControlToolkit.AccordionPane newAccordion = new AjaxControlToolkit.AccordionPane();
                        newAccordion.HeaderContainer.Controls.Add(new LiteralControl(headerText));
                                        
                        AjaxControlToolkit.Accordion units = new AjaxControlToolkit.Accordion();
                        units.ID = "project" + Convert.ToString(i + 1) + "Units";
                        //add pane with header and content of unit ref textbox
                        AjaxControlToolkit.AccordionPane unit1 = new AjaxControlToolkit.AccordionPane();
                        unit1.ID = "project" + Convert.ToString(i + 1) + "Unit1";
                        unit1.HeaderContainer.Controls.Add(new LiteralControl(headerText + "/Unit 1"));
                        unit1.ContentContainer.Controls.Add(new LiteralControl("Unit ref: "));
                        TextBox unitRef = new TextBox();
                        unitRef.ID = unit1.ID + "UnitRef";
                        unit1.ContentContainer.Controls.Add(unitRef);
                        units.Panes.Add(unit1);
                        newAccordion.ContentContainer.Controls.Add(units);
                        
                        projects.Panes.Add(newAccordion);
                    }
                }
            }
        Last edited by Rabbit; Feb 24 '15, 05:48 PM. Reason: Please use [code] and [/code] tags when posting questions or formatted data.

        Comment

        Working...