Accordion

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • srilakshmim
    New Member
    • Jul 2007
    • 22

    Accordion

    Hello
    I want to create Accordion (Ajax Control Tool Kit).
    My Code is as follows
    [code=cpp]
    protected void Page_Load(objec t sender, EventArgs e)
    {
    try
    {
    Accordion aCC = new Accordion();
    AccordionPane aPane = new AccordionPane() ;
    aPane.Width=300 ;
    aPane.HeaderCon tainer.Controls .Add(new LiteralControl( "Dyanamic Accordiaon"));
    aPane.ContentCo ntainer.Control s.Add(new LiteralControl( "jdfh"));
    aCC.Panes.Add(a Pane);
    AccordionPane aPane1 = new AccordionPane() ;
    aPane1.Width = 300;
    aPane1.HeaderCo ntainer.Control s.Add(new LiteralControl( "Collapse") );
    aPane1.ContentC ontainer.Contro ls.Add(new LiteralControl( "jdfgdth")) ;
    aCC.Panes.Add(a Pane1);
    aCC.Visible = true;
    }
    catch(Exception e1)
    {
    Response.Write( e1);

    }


    }[/code]
    But Accordion is not visible and also no errors
    when i created Accordion in designing & iam adding AccordionPanes to that Accordion then it is working quite good.
    Please any one solve it
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Originally posted by srilakshmim
    Hello
    I want to create Accordion (Ajax Control Tool Kit).
    My Code is as follows
    [code=cpp]
    protected void Page_Load(objec t sender, EventArgs e)
    {
    try
    {
    Accordion aCC = new Accordion();
    AccordionPane aPane = new AccordionPane() ;
    aPane.Width=300 ;
    aPane.HeaderCon tainer.Controls .Add(new LiteralControl( "Dyanamic Accordiaon"));
    aPane.ContentCo ntainer.Control s.Add(new LiteralControl( "jdfh"));
    aCC.Panes.Add(a Pane);
    AccordionPane aPane1 = new AccordionPane() ;
    aPane1.Width = 300;
    aPane1.HeaderCo ntainer.Control s.Add(new LiteralControl( "Collapse") );
    aPane1.ContentC ontainer.Contro ls.Add(new LiteralControl( "jdfgdth")) ;
    aCC.Panes.Add(a Pane1);
    aCC.Visible = true;
    }
    catch(Exception e1)
    {
    Response.Write( e1);

    }


    }[/code]
    But Accordion is not visible and also no errors
    when i created Accordion in designing & iam adding AccordionPanes to that Accordion then it is working quite good.
    Please any one solve it
    Is there any reason why you can't create the Accordian in design and then fill it in the Server side code?

    -Frinny

    Comment

    • srilakshmim
      New Member
      • Jul 2007
      • 22

      #3
      I want to create Accordion dynamically.
      Iam inserting it in gridview template column
      If there are more records in the gridview then it is taking much time to load
      Thanks for your reply

      Comment

      • Frinavale
        Recognized Expert Expert
        • Oct 2006
        • 9749

        #4
        Originally posted by srilakshmim
        I want to create Accordion dynamically.
        Iam inserting it in gridview template column
        If there are more records in the gridview then it is taking much time to load
        Thanks for your reply
        I think you're going to have to register the control in the page for it to show up.
        Have you used Controls.Add(my Accordion) in your code to add your dynamically created accordion control to your page?

        -Frinny

        Comment

        • srilakshmim
          New Member
          • Jul 2007
          • 22

          #5
          [QUOTE=Frinavale]I think you're going to have to register the control in the page for it to show up.
          Have you used Controls.Add(my Accordion) in your code to add your dynamically created accordion control to your page?

          -Frinny[/QUO

          Hello
          I tried it in 2 ways
          1st way

          I created 1 panel in design
          and i wrote code as
          Panel1.Controls .Add(aCC);

          2nd way
          Scriptmanger1.C ontrols.Add(aCC );

          But in both the cases
          the unHandled Exception while running

          is as follows

          System.InvalidO perationExcepti on was unhandled by user code
          Message="The TargetControlID of '_AccordionExte nder' is not valid. The value cannot be null or empty."
          Source="System. Web.Extensions"
          StackTrace:
          at System.Web.UI.E xtenderControl. RegisterWithScr iptManager()
          at System.Web.UI.E xtenderControl. OnPreRender(Eve ntArgs e)
          at AjaxControlTool kit.ExtenderCon trolBase.OnPreR ender(EventArgs e)
          at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
          at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
          at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
          at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
          at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
          at System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)

          Comment

          • robertonline
            New Member
            • Jul 2007
            • 1

            #6
            Set the aCC.ID! It will work fine!

            [QUOTE=srilakshm im]
            Originally posted by Frinavale
            I think you're going to have to register the control in the page for it to show up.
            Have you used Controls.Add(my Accordion) in your code to add your dynamically created accordion control to your page?

            -Frinny[/QUO

            Hello
            I tried it in 2 ways
            1st way

            I created 1 panel in design
            and i wrote code as
            Panel1.Controls .Add(aCC);

            2nd way
            Scriptmanger1.C ontrols.Add(aCC );

            But in both the cases
            the unHandled Exception while running

            is as follows

            System.InvalidO perationExcepti on was unhandled by user code
            Message="The TargetControlID of '_AccordionExte nder' is not valid. The value cannot be null or empty."
            Source="System. Web.Extensions"
            StackTrace:
            at System.Web.UI.E xtenderControl. RegisterWithScr iptManager()
            at System.Web.UI.E xtenderControl. OnPreRender(Eve ntArgs e)
            at AjaxControlTool kit.ExtenderCon trolBase.OnPreR ender(EventArgs e)
            at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
            at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
            at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
            at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
            at System.Web.UI.C ontrol.PreRende rRecursiveInter nal()
            at System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint)

            Comment

            • axxon
              New Member
              • Jul 2007
              • 6

              #7
              [QUOTE=robertonl ine]Set the aCC.ID! It will work fine!

              Hi i think ACC is the ID and I am running into the same problem!!! can u show me the actual code that works?
              Thnx

              Comment

              • ClausMAdsen
                New Member
                • Aug 2007
                • 1

                #8
                Originally posted by axxon
                Originally posted by robertonline
                Set the aCC.ID! It will work fine!



                Hi i think ACC is the ID and I am running into the same problem!!! can u show me the actual code that works?
                Thnx

                Sorry for the ugly code, but this post helped me the last way - i had the same problem:
                [code=cpp]
                ScriptManager manager = new ScriptManager() ;
                form1.Controls. Add(manager);

                Label label_a_head = new Label();
                label_a_head.Te xt = "Label A Head";
                Label label_a_content = new Label();
                label_a_content .Text = "Label A Content";

                Label label_b_head = new Label();
                label_b_head.Te xt = "Label B Head";
                Label label_b_content = new Label();
                label_b_content .Text = "Label B Content";

                Accordion ac = new Accordion();
                ac.ID = "AccordionI D";

                AccordionPane ap1 = new AccordionPane() ;
                ap1.HeaderConta iner.Controls.A dd(label_a_head );
                ap1.ContentCont ainer.Controls. Add(label_a_con tent);
                ac.Panes.Add(ap 1);

                AccordionPane ap2 = new AccordionPane() ;
                ap2.HeaderConta iner.Controls.A dd(label_b_head );
                ap2.ContentCont ainer.Controls. Add(label_b_con tent);
                ac.Panes.Add(ap 2);

                form1.Controls. Add(ac);
                [/code]
                And Smile...Have a nice day :-)

                Comment

                Working...