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
Ben Rush - 03 Apr 2007 03:33 GMT
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...

Signature
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
> Hi:
>
[quoted text clipped - 4 lines]
> Thanks,
> GJM
Jeff B. - 11 Jun 2007 02:43 GMT
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-Collapsi
blePanel.ht