A bit of background: I had created a user control (ascx) that contained a RadPanelBar containing two RadPanelItems each with their own item templates with various other controls. I have everything working just as I like it.
I am now in the process of converting that control into a server control and ran into a problem. I followed an example provided in the documentation that explained how to programmatically add a RadPanelBar with ItemTemplates (Found in the docs here: Controls/RadPanelBar/Templates/Adding Templates at run-time) and I was able to display the panel bar exactly as it describes, but the panels won't expand or collapse.
What am I missing?
Here's my code so far:
I am now in the process of converting that control into a server control and ran into a problem. I followed an example provided in the documentation that explained how to programmatically add a RadPanelBar with ItemTemplates (Found in the docs here: Controls/RadPanelBar/Templates/Adding Templates at run-time) and I was able to display the panel bar exactly as it describes, but the panels won't expand or collapse.
What am I missing?
Here's my code so far:
| [ToolboxData("<{0}:CustNameSidErpDeptProd runat=server></{0}:CustNameSidErpDeptProd>")] |
| public class CustNameSidErpDeptProd : WebControl |
| { |
| #region Member Variables |
| private readonly RadPanelBar _radPanelBar = new RadPanelBar(); |
| private readonly RadPanelItem _rpi = new RadPanelItem("PanelItem1"); |
| #endregion |
| #region Properties |
| #endregion |
| #region Overrides |
| protected override void OnInit(EventArgs e) |
| { |
| _radPanelBar.AllowCollapseAllItems = true; |
| _radPanelBar.ExpandMode = PanelBarExpandMode.SingleExpandedItem; |
| _radPanelBar.EnableViewState = true; |
| _radPanelBar.Width = Unit.Percentage(100); |
| _rpi.ItemTemplate = new TextBoxTemplate(); |
| base.OnInit(e); |
| } |
| protected override void OnLoad(EventArgs e) |
| { |
| _radPanelBar.Items.Add(_rpi); |
| _radPanelBar.Items.Add(new RadPanelItem("PanelItem2")); |
| _radPanelBar.DataBind(); |
| Controls.Add(_radPanelBar); |
| } |
| #endregion |
| #region Public Methods |
| #endregion |
| #region Private Methods |
| #endregion |
| } |