public void LoadControls(PanelControlsConfiguration panelConfig) { if (panelConfig != null) { PageConfig pageConfig = getConfigForCurrentPage(panelConfig); if (pageConfig != null) { if (pageConfig.Params != null) { foreach (UserControlParam param in pageConfig.Params) { setParam(Page, param.Name, param.Value); } } if (null != pageConfig.ConfiguredProperties) { foreach (ConfiguredProperty prop in pageConfig.ConfiguredProperties) { prop.Init(); setParam(Page, prop.TargetName, prop.TargetValue); } } if (pageConfig.LeftPanelConfig.Controls.Length > 0) { loadControlsForPanel(LeftPanel, pageConfig.LeftPanelConfig.Controls); } else { if (null != trHeaderRow) { tdleft.Visible = false; } else { divleft.Visible = false; } try { if (!String.IsNullOrEmpty(tdleft.Width)) { int widthOfLeftPanel = int.Parse(tdleft.Width.Substring(0, tdleft.Width.Length - 2)); int widthofCenterPanel = int.Parse(divCenter.Style["width"].Substring(0, divCenter.Style["width"].Length - 2)); widthofCenterPanel += widthOfLeftPanel; divCenter.Style.Remove("width"); divCenter.Style.Add("width", widthofCenterPanel + "px"); } } catch { } } loadControlsForPanel(RightPanel, pageConfig.RightPanelConfig.Controls); } } }
private PageConfig getConfigForCurrentPage(PanelControlsConfiguration panelConfig) { string[] parts = Request.RawUrl.Split('/'); foreach (PageConfig pConfig in panelConfig.Pages) { if (pConfig.PageName.ToUpper() == getPageName(parts[parts.Length - 1].ToUpper())) { return(pConfig); } } return(null); }