[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 896
  • Last Modified:

How do I programmatically build an AJAX Toolkit Accordian Pane?

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;
apne.Controls.Add(...);
myAccordian.Panes.Add(apne);

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?

Thanks,
Bruce



I'm sure there will be other issues.


0
Bruce
Asked:
Bruce
1 Solution
 
jabcocoCommented:
You can set the header dynamically by adding controls in the "HeaderContainer" property.

Ref
http://www.asp.net/learn/ajax-control-toolkit/
http://www.asp.net/learn/ajax-control-toolkit/tutorial-01-cs.aspx
http://www.asp.net/learn/ajax-control-toolkit/tutorial-02-cs.aspx

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

Open in new window

0
 
BruceAuthor Commented:
These are excellent!  Thanks jabcoco!

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

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now