/// <summary> /// Create the control contains all components for the dynamic page configuration. /// </summary> /// <param name="dynamicPageConfiguration"></param> /// <returns></returns> public Control Create(DynamicPageConfiguration dynamicPageConfiguration) { PlaceHolder placeHolder = new PlaceHolder(); bool isTopPanel = true; foreach (BasePanelConfiguration basePanelConfiguration in dynamicPageConfiguration.Panels) { WebControl createdControl = null; switch (basePanelConfiguration.PanelType) { case DynamicPagePanelTypes.ButtonPanel: createdControl = CreateButtonPanel(basePanelConfiguration); break; case DynamicPagePanelTypes.GridViewPanel: createdControl = CreateGridViewPanel(basePanelConfiguration, dynamicPageConfiguration); createdControl.Style["margin-top"] = isTopPanel ? "2px" : "4px"; break; case DynamicPagePanelTypes.QueryPanel: createdControl = CreateQueryPanel(basePanelConfiguration); createdControl.Style["margin-top"] = isTopPanel ? "2px" : "4px"; break; } if (createdControl != null) { isTopPanel = false; placeHolder.Controls.Add(createdControl); } } return placeHolder; }
/// <summary> /// Create object by specified xml doc and returns created key-value pair (object id and dynamic page instance). /// </summary> /// <param name="xmldoc"></param> protected override KeyValuePair<string, object> CreateConfigurationObject(XmlDocument xmldoc) { XmlElement pageElement = xmldoc.SelectSingleNode("p:Page", this.XmlParser.NamespaceManager) as XmlElement; DynamicPageConfiguration config = new DynamicPageConfiguration(pageElement, this.XmlParser); return new KeyValuePair<string, object>(config.ObjectId, config); }
private static GridViewPanelPluginConfiguration4DetailPanel ResolveDetailPanelConfiguration(DynamicPageConfiguration dynamicPageConfiguration) { AggregatePanelConfiguration configuration = dynamicPageConfiguration.Panels.FirstOrDefault(p => p.PanelType == DynamicPagePanelTypes.DetailPanel) as AggregatePanelConfiguration; if (configuration == null) return new GridViewPanelPluginConfiguration4DetailPanel(); return new GridViewPanelPluginConfiguration4DetailPanel { Draggable = configuration.Draggable, Resizable = configuration.Resizable, Height = configuration.Height, Width = configuration.Width, EditableHeaderText = configuration.HeaderText, ViewableHeaderText = configuration.HeaderText }; }
private static WebControl CreateGridViewPanel(BasePanelConfiguration panelConfiguration, DynamicPageConfiguration dynamicPageConfiguration) { Panel gridPanelContainer = null; GridViewPanelConfiguration configuration = panelConfiguration as GridViewPanelConfiguration; if (configuration != null) { gridPanelContainer = new Panel { CssClass = "gridviewpanel" }; GridViewPanel gridViewPanel = new GridViewPanel { ID = string.Format(CultureInfo.InvariantCulture, "GridViewPanel_{0}_{1}", QueryStringUtility.ObjectId, configuration.Id), Configuration = configuration, AsUniqueGridView = true, DetailPanelPlugin = ResolveDetailPanelConfiguration(dynamicPageConfiguration), AggregatePanelPlugin = ResolveAggregatePanelConfiguration(dynamicPageConfiguration) }; gridPanelContainer.Controls.Add(gridViewPanel); } return gridPanelContainer; }