private void GetRegion() { List <ControlData> _list = new List <ControlData>(); try { int PageLayoutId = TypeHelper.ToInt32(ddlPageLayout.SelectedValue); SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO(); SYS_PageLayout _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutById(PageLayoutId); SYS_TemplatePageBSO _templateBSO = new SYS_TemplatePageBSO(); SYS_TemplatePage _template = _templateBSO.GetSYS_TemplatePageById(_pageLayout.TemplateId); Control objControl = (Control)this.LoadControl(ResolveUrl("~/") + "Client/Skins/Templates/" + _template.TemplateControl); ControlCollection _controls = objControl.Controls; foreach (Control obj1 in _controls) { Type objType = obj1.GetType(); if (obj1 != null) { if (obj1.ID != null) { ControlData objData = new ControlData(); objData.Control = obj1.ID; if (obj1 != null) { objData.Text = obj1.ID; _list.Add(objData); } } } } ddlRegion.Items.Clear(); ddlRegion.DataSource = _list; ddlRegion.DataTextField = "Text"; ddlRegion.DataValueField = "Control"; ddlRegion.DataBind(); } catch { ddlRegion.Items.Clear(); ddlRegion.DataSource = _list; ddlRegion.DataTextField = "Text"; ddlRegion.DataValueField = "Control"; ddlRegion.DataBind(); } }
private void initControl(int Id) { if (Id > 0) { btn_add.Visible = false; btn_edit.Visible = true; btn_add1.Visible = false; btn_add2.Visible = false; btn_edit1.Visible = true; try { SYS_PageLayoutBSO _pageLayoutBSO = new SYS_PageLayoutBSO(); SYS_PageLayout _pageLayout = _pageLayoutBSO.GetSYS_PageLayoutById(Id); hddID.Value = Convert.ToString(_pageLayout.Id); txtName.Text = _pageLayout.PageName; txtSlug.Text = _pageLayout.SlugPageName; txtOrder.Text = _pageLayout.Orders.ToString(); BindDropDownList(); ddlTemplate.SelectedValue = Convert.ToString(_pageLayout.TemplateId); } catch (Exception ex) { clientview.Text = ex.Message.ToString(); } } else { BindDropDownList(); btn_edit.Visible = false; btn_add.Visible = true; btn_edit1.Visible = false; btn_add1.Visible = true; btn_add2.Visible = true; } }