Friday, 14 December 2012

Dynamically Add Collapsible Panel Extender from code behind c#

protected void Page_Load(object sender, EventArgs e)
{
CollapsiblePanelExtender collapsiblePanelExtender = new CollapsiblePanelExtender();
collapsiblePanelExtender.TargetControlID = this.ContentPanel.ID; //your panel id
collapsiblePanelExtender.ExpandControlID = this.LinkButton.ID;//your link button id
 collapsiblePanelExtender.CollapseControlID = this.LinkButton.ID;
//your panel id collapsiblePanelExtender.ScrollContents = false;
collapsiblePanelExtender.Collapsed = false;
collapsiblePanelExtender.ExpandDirection =CollapsiblePanelExpandDirection.Vertical;
collapsiblePanelExtender.SuppressPostBack = true;
collapsiblePanelExtender.TextLabelID = this.TextLabel.ID; //your label id
collapsiblePanelExtender.CollapsedText = "Collapsed";
collapsiblePanelExtender.ExpandedText = "Opended";
//the name of panel that containt CollapsiblePanelExtender
 this.panelExtenderContainer.Controls.Add(collapsiblePanelExtender);
}

No comments:

Post a Comment