public override void SyncChanges() { EnsureChildControls(); BusinessSearch.BusinessSearch webpart = this.WebPartToEdit as BusinessSearch.BusinessSearch; if (webpart == null) { return; } string templateID = webpart.TemplateID; string communicationID = webpart.CommunicationID; string isAuto = webpart.IsAutoSearch; string jsLink = webpart.JsScript; //ddlTemplateID.SelectedValue = templateID; ddlCommunicationID.SelectedValue = communicationID; cbIsAutoSearch.Checked = isAuto == "Y"; tbJSLink.Text = jsLink; tbTitle.Text = webpart.BusSearchTitle; if (!string.IsNullOrEmpty(templateID)) { BS_TEMPLATE_MAINBLL temp = new BS_TEMPLATE_MAINBLL(); BS_TEMPLATE_MAIN model = temp.GetModel(Guid.Parse(templateID)); if (model != null) { ddlMainCategory.SelectedValue = model.BigCategory; BindSmallCategory(model.BigCategory); ddlSubCategory.SelectedValue = model.SmallCategory; BindTemplate(templateID); } } }
public override bool ApplyChanges() { this.EnsureChildControls(); BusinessSearch.BusinessSearch webpart = this.WebPartToEdit as BusinessSearch.BusinessSearch; if (webpart == null) { return(false); } webpart.TemplateID = ddlTemplateID.SelectedValue; webpart.CommunicationID = ddlCommunicationID.SelectedValue; webpart.IsAutoSearch = cbIsAutoSearch.Checked ? "Y" : "N"; webpart.JsScript = tbJSLink.Text; webpart.BusSearchTitle = tbTitle.Text; return(true); }
protected override void CreateChildControls() { //ms-TPBorder width:100% TemplateConfigComponent Tempcom = new TemplateConfigComponent(); ddlMainCategory = new DropDownList(); ddlMainCategory.Attributes.Add("style", "width:100%"); ddlMainCategory.AutoPostBack = true; ddlMainCategory.SelectedIndexChanged += ddlMainCategory_SelectedIndexChanged; DataTable dt = BaseComponent.GetUserLookupTypesByCode("模板"); if (dt != null && dt.Rows.Count > 0) { ddlMainCategory.DataSource = dt; ddlMainCategory.DataTextField = "LOOKUP_NAME"; ddlMainCategory.DataValueField = "LOOKUP_CODE"; ddlMainCategory.DataBind(); } ddlSubCategory = new DropDownList(); ddlSubCategory.Attributes.Add("style", "width:100%"); ddlSubCategory.AutoPostBack = true; ddlSubCategory.SelectedIndexChanged += ddlSubCategory_SelectedIndexChanged; ddlTemplateID = new DropDownList(); ddlTemplateID.AutoPostBack = true; ddlTemplateID.Attributes.Add("style", "width:100%"); //DataTable template = Tempcom.GetEnableTemplate(); //if (template != null && template.Rows.Count > 0) //{ // ddlTemplateID.DataSource = template; // ddlTemplateID.DataTextField = "TemplateName"; // ddlTemplateID.DataValueField = "TemplateID"; // ddlTemplateID.DataBind(); //} ddlTemplateID.SelectedIndexChanged += ddlTemplateID_SelectedIndexChanged; BindSmallCategory(ddlMainCategory.SelectedValue); BindTemplate(); ddlCommunicationID = new DropDownList(); ddlCommunicationID.Attributes.Add("style", "width:100%"); BusinessSearch.BusinessSearch webpart = this.WebPartToEdit as BusinessSearch.BusinessSearch; BindCommunication(webpart.TemplateID); tbJSLink = new TextBox(); tbJSLink.TextMode = TextBoxMode.MultiLine; tbJSLink.Attributes.Add("style", "width:100%"); tbJSLink.Height = 200; tbTitle = new TextBox(); tbTitle.Attributes.Add("style", "width:100%"); lbTableID = new Label(); lbTableID.Attributes.Add("style", "width:100%"); lbTableID.Text = this.WebPartToEdit.ID + "_normaltab"; cbIsAutoSearch = new CheckBox(); this.Controls.Add(new LiteralControl("<b>标题</b><br/>")); this.Controls.Add(tbTitle); this.Controls.Add(new LiteralControl("<br/><b>报表ID</b>")); this.Controls.Add(lbTableID); this.Controls.Add(new LiteralControl("<br/><br/><b>报表大类</b>")); this.Controls.Add(ddlMainCategory); this.Controls.Add(new LiteralControl("<br/><br/><b>报表细类</b>")); this.Controls.Add(ddlSubCategory); this.Controls.Add(new LiteralControl("<br/><br/><b>模板名称</b>")); this.Controls.Add(ddlTemplateID); this.Controls.Add(new LiteralControl("<br/><br/><b>通信业务名称</b><br/>")); this.Controls.Add(ddlCommunicationID); this.Controls.Add(new LiteralControl("<br/><br/><b>是否自动加载数据</b><br/>")); this.Controls.Add(cbIsAutoSearch); this.Controls.Add(new LiteralControl("<br/><br/><b>javascript</b><br/>")); this.Controls.Add(tbJSLink); this.Controls.Add(new LiteralControl("<br/><br/><br/>")); //Parent.Controls[2].Visible = false; base.CreateChildControls(); this.ChildControlsCreated = true; }