dynamic creation of CollapsiblePanel

J

jmgopi

Hi:

Can somebody provide me samples on how to create a dynamic
CollapsiblePanel using ASP.NET AJAX Toolkit. Any points are highly
appreciated.

Thanks,
GJM
 
B

Ben Rush

Sure. But can you be more specific about what you mean by dynamic, please? I
want to make sure I understand what you're saying...
 
J

Jeff B.

Here is what I use to create a collapsible panel dynamically. It's a function that takes in two other asp panels--one for the header and one for the content. the only thing this function needs knowledge of is the ID of the button used for the ImageControlID. You can probably do something to make it totally dynamic by looking through the controls in the header panel for an image control matching a pattern on the name.

The return from this function needs to be added to another panel that exists on the page.

private AjaxControlToolkit.CollapsiblePanelExtender PopulateCollapsiblePanel(Panel headerPanel, Panel bodyPanel)
{
collapsiblePan = new CollapsiblePanelExtender();
collapsiblePan.ExpandControlID = headerPanel.UniqueID;
collapsiblePan.CollapseControlID = headerPanel.UniqueID;
collapsiblePan.TargetControlID = bodyPanel.UniqueID;
collapsiblePan.Collapsed = false;
collapsiblePan.ID = "collapsiblePan";
collapsiblePan.ExpandedText = "Click to Collapse";
collapsiblePan.CollapsedText = "Click to Expand";
collapsiblePan.ImageControlID = "controlBtn";
collapsiblePan.ExpandedImage = "~/images/collapse_blue.jpg";
collapsiblePan.CollapsedImage = "~/images/expand_blue.jpg";
collapsiblePan.EnableViewState = true;
//collapsiblePan.SuppressPostBack = true;
collapsiblePan.EnableClientState = true;
return collapsiblePan;


From http://www.developmentnow.com/g/8_2007_4_0_0_953045/dynamic-creation-of-CollapsiblePanel.ht

Posted via DevelopmentNow.com Group
http://www.developmentnow.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top