using System; using System.Collections.Generic; using System.Text; using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; namespace Symber.Web.APX { [ParseChildren(true)] [PersistChildren(false)] public class APXAccordionPane : WebControl { #region [ Fields ] private APXAccordionContentPanel _header; private APXAccordionContentPanel _content; private ITemplate _headerTemplate; private ITemplate _contentTemplate; #endregion #region [ Properties ] [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public APXAccordionContentPanel HeaderContainer { get { EnsureChildControls(); return _header; } } [Browsable(true)] [Category("Appearance")] [Description("CSS class for Accordion Pane Header")] public string HeaderCssClass { get { EnsureChildControls(); return _header.CssClass; } set { EnsureChildControls(); _header.CssClass = value; } } [Browsable(false)] [DefaultValue(null)] [Description("Accordion Pane Header")] [PersistenceMode(PersistenceMode.InnerProperty)] [TemplateContainer(typeof(APXAccordionContentPanel))] [TemplateInstance(TemplateInstance.Single)] public virtual ITemplate Header { get { return _headerTemplate; } set { _headerTemplate = value; } } [Browsable(false)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public APXAccordionContentPanel ContentContainer { get { EnsureChildControls(); return _content; } } [Browsable(true)] [Category("Appearance")] [Description("CSS class for Accordion Pane Content")] public string ContentCssClass { get { EnsureChildControls(); return _content.CssClass; } set { EnsureChildControls(); _content.CssClass = value; } } [Browsable(false)] [DefaultValue(null)] [Description("Accordion Pane Content")] [PersistenceMode(PersistenceMode.InnerProperty)] [TemplateContainer(typeof(APXAccordionContentPanel))] [TemplateInstance(TemplateInstance.Single)] public virtual ITemplate Content { get { return _contentTemplate; } set { _contentTemplate = value; } } #endregion #region [ Override Implementation of WebControl ] public override ControlCollection Controls { get { EnsureChildControls(); return base.Controls; } } protected override void CreateChildControls() { // Create the controls Controls.Clear(); Controls.Add(_header = new APXAccordionContentPanel(null, -1, APXAccordionItemType.Header)); Controls.Add(_content = new APXAccordionContentPanel(null, -1, APXAccordionItemType.Content)); // By default, collapse the content sections so the // page loads without flicker (the selected section // will be expanded again in the parent Accordion's // OnPreRender) _content.Collapsed = true; // Load the templates into the controls if (_headerTemplate != null) _headerTemplate.InstantiateIn(_header); if (_contentTemplate != null) _contentTemplate.InstantiateIn(_content); } public override Control FindControl(string id) { EnsureChildControls(); return base.FindControl(id) ?? _header.FindControl(id) ?? _content.FindControl(id); } public override void RenderBeginTag(HtmlTextWriter writer) { // Do not call base.RenderBeginTag... } public override void RenderEndTag(HtmlTextWriter writer) { // Do not call base.RenderEndTag... } #endregion } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)