| using System; |
| using System.Collections.Generic; |
| using System.Linq; |
| using System.Web; |
| using System.Web.UI; |
| using System.Web.UI.WebControls; |
| using Telerik.Web.UI; |
| using System.ComponentModel; |
| using System.Web.Script.Serialization; |
| |
| public partial class PanelView : System.Web.UI.UserControl |
| { |
| #region ContentTemplate Code |
| |
| private ITemplate leftContentTemplate = null; |
| private ITemplate rightContentTemplate = null; |
| |
| public class ContentContainer : WebControl, INamingContainer { } |
| |
| [TemplateContainer(typeof(ContentContainer))] |
| [PersistenceMode(PersistenceMode.InnerProperty)] |
| [TemplateInstance(TemplateInstance.Single)] |
| [Browsable(true)] |
| [Category("Behavior")] |
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] |
| public ITemplate LeftPaneContentTemplate |
| { |
| get { return leftContentTemplate; } |
| set { leftContentTemplate = value; } |
| } |
| |
| [TemplateContainer(typeof(ContentContainer))] |
| [PersistenceMode(PersistenceMode.InnerProperty)] |
| [TemplateInstance(TemplateInstance.Single)] |
| [Browsable(true)] |
| [Category("Behavior")] |
| [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] |
| public ITemplate RightPaneContentTemplate |
| { |
| get { return rightContentTemplate; } |
| set { rightContentTemplate = value; } |
| } |
| |
| protected override void OnInit(EventArgs e) |
| { |
| base.OnInit(e); |
| |
| if (LeftPaneContentTemplate != null) |
| { |
| // Instantiate and initialize the content container class |
| ContentContainer containerLeft = new ContentContainer(); |
| LeftPaneContentTemplate.InstantiateIn(containerLeft); |
| |
| // Add the content template to the placeholder so that we can see the user content |
| LeftPaneContent.Controls.Add(containerLeft); |
| } |
| else |
| { |
| LeftPaneVisible = false; |
| } |
| |
| if (RightPaneContentTemplate != null) |
| { |
| // Instantiate and initialize the content container class |
| ContentContainer containerRight = new ContentContainer(); |
| RightPaneContentTemplate.InstantiateIn(containerRight); |
| |
| // Add the content template to the placeholder so that we can see the user content |
| RightPaneContent.Controls.Add(containerRight); |
| } |
| else |
| { |
| RightPaneVisible = false; |
| } |
| } |
| |
| #endregion |
| |
| #region Properties |
| |
| public bool LeftPaneVisible |
| { |
| get{ return LeftPane.Visible; } |
| set{ LeftPane.Visible = value;} |
| } |
| public bool RightPaneVisible |
| { |
| get { return RightPane.Visible; } |
| set { RightPane.Visible = value; } |
| } |
| |
| public string LeftPaneTitle |
| { |
| get { return LeftPaneCaption.Text; } |
| set { LeftPaneCaption.Text = value; } |
| } |
| public string RightPaneTitle |
| { |
| get { return RightPaneCaption.Text; } |
| set { RightPaneCaption.Text = value; } |
| } |
| |
| public Orientation CurrentOrientation |
| { |
| get { return RadSplitter1.Orientation; } |
| set { RadSplitter1.Orientation = value; } |
| } |
| |
| public bool ChromeCompatibilityMode |
| { |
| get; |
| set; |
| } |
| |
| #endregion |
| |
| protected override void OnPreRender(EventArgs e) |
| { |
| base.OnPreRender(e); |
| |
| if (!LeftPaneVisible || !RightPaneVisible) |
| { |
| RadSplitBar1.Visible = false; |
| } |
| |
| if (ChromeCompatibilityMode) |
| { |
| rsbChrome.Visible = true; |
| |
| List<string> IDs = new List<string>(); |
| |
| FillWithGridIDs(IDs, Page.Controls); |
| |
| JavaScriptSerializer js = new JavaScriptSerializer(); |
| |
| ScriptManager.RegisterArrayDeclaration(Page, "radGrids", js.Serialize(IDs)); |
| } |
| } |
| |
| protected void Page_Load(object sender, EventArgs e) |
| { |
| |
| } |
| |
| private void FillWithGridIDs(List<string> gridIDs, ControlCollection controls) |
| { |
| foreach (Control ctrl in controls) |
| { |
| if (ctrl is RadGrid) |
| { |
| gridIDs.Add(ctrl.ClientID); |
| } |
| |
| FillWithGridIDs(gridIDs, ctrl.Controls); |
| } |
| } |
| } |