How do I programmatically build an AJAX Toolkit Accordian Pane?

Posted on 2009-02-23
Last Modified: 2013-12-17
I would like to use an Accordian Pane to represent dynamically created options in the database.  

I would like to programmatically populate an AccordianPane based on data.  The data is business functions which is categorized by business function type.  Here is what I am looking to represent:

|  BusFuncType 1                             |         <-- Pane 1
BusFunc 1
BusFunc 2
BusFunc 3
|  BusFuncType 2                             |         <-- Pane 2
BusFunc 4
BusFunc 5
BusFunc 6

I see that you can add panes to an accordian control

AccordianPane apne = null;

The first problem I am having is setting up the Header Text for each pane.  apne.Header takes an ITemplate not a string.  Do I need to create a class that implements ITemplate?


I'm sure there will be other issues.

Question by:Bruce
    LVL 10

    Accepted Solution

    You can set the header dynamically by adding controls in the "HeaderContainer" property.


    Let me know.
    AccordionPane oPane = new AccordionPane()
    oPane.HeaderContainer.Controls.Add(new LiteralControl("My Header"));

    Open in new window

    LVL 1

    Author Closing Comment

    These are excellent!  Thanks jabcoco!

    I've book marked the Tutorials page.  I'll have to pour over those in the near future.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now