protected System.Web.UI.Control CreateDate(string ControlName, out DesignFormField oDesign, Boolean IsUpdate) { oDesign = new DesignFormField(); if (!IsUpdate) { oDesign = oFormField; } oDesign.IsCalendar = chkWithCalendar.Checked == true ? true : false; oDesign.IsMandatory = chkddlMandatory.Checked == true ? true : false; oDesign.Message = txtddlMSG.Text; oDesign.DateFormat = ddlCalendarFormat.SelectedValue; oDesign.Width = Convert.ToInt16 ( txtDateWidth.Text); oDesign.Height = Convert.ToInt16(txtDateHeight.Text); TextBox oTextBox = new TextBox(); oTextBox.ID = "txtDateEform" + ControlName; oTextBox.ToolTip = oTextBox.ID; if (SkinID == string.Empty) { oTextBox.SkinID = TextBoxDateSkinID; } else { oTextBox.SkinID = SkinID; } if (chkddlMandatory.Checked) { oDesign.IsMandatory = true; oDesign.Message = txtddlMSG.Text; } //DateTime type. string DataType = "DateTime"; iControlType = Convert.ToInt16(FormDesign.ControlType.DateTime); // DesignFormField.ModifyDBTable(DBTableName, ControlName, DataType, IsUpdate, Convert.ToInt16(hidFieldID.Value), Convert.ToInt32(eFormID), oDesign); return (System.Web.UI.Control)oTextBox; }
protected System.Web.UI.Control CreateDropDownList(string ControlName, out DesignFormField oDesign, Boolean IsUpdate) { oDesign = new DesignFormField(); if (!IsUpdate) { oDesign = oFormField; } if (radValueList.Checked) { oDesign.IsDataList = true; oDesign.DataListType = ddlValueList.SelectedValue; oFormField.DataListType = ddlValueList.SelectedItem.Value; } else { oDesign.IsDataList = false; oDesign.QueryStatement = txtQuery.Text; } DropDownList oDDL = new DropDownList(); oDDL.ID = "ddlEform" + ControlName; oDDL.ToolTip = oDDL.ID; if (SkinID == string.Empty) { oDDL.SkinID = DropDownListDefaultsKinID; } else { oDDL.SkinID = SkinID; } //Nvarchar type. Default size is 200 string DataType = "nVarchar(500)"; iControlType = iControlType = Convert.ToInt16(FormDesign.ControlType.DrowDownList); // DesignFormField.ModifyDBTable(DBTableName, ControlName, DataType, IsUpdate, Convert.ToInt16(hidFieldID.Value), Convert.ToInt32(eFormID), oDesign); return (System.Web.UI.Control)oDDL; }
protected void SetTextBox(DesignFormField offield) { this.accordionFormDesign.SelectedIndex = 0; AccordionPane oPane = accordionFormDesign.Panes[this.accordionFormDesign.SelectedIndex]; oPane.Enabled = true; if (offield.Height.ToString() != string.Empty) { txtboxHeight.Text = offield.Height.ToString(); } if (offield.Width.ToString() != string.Empty) { txtboxWidth.Text = offield.Width.ToString(); } // txtSize.Text = offield.ControlSize == null ? string.Empty : offield.ControlSize; ChkReadOnly.Checked = offield.IsReadOnly == true ? true : false; chkMandatory.Checked = offield.IsMandatory == true ? true : false; if (chkMandatory.Checked) { txtMSG.Text = offield.Message; txtMSG.Enabled = true; } this.radText.Checked = true; this.radTextArea.Checked = false; this.radMoney.Checked = false; }
protected System.Web.UI.Control CreateCheckbox(string ControlName, out DesignFormField oDesign, Boolean IsUpdate) { oDesign = new DesignFormField(); if (!IsUpdate) { oDesign = oFormField; } CheckBox oCheckBox = new CheckBox(); oCheckBox.ID = "chkEform" + ControlName; oCheckBox.ToolTip = oCheckBox.ID; if (SkinID == string.Empty) { oCheckBox.SkinID = CheckBoxDefaultsKinID; } else { oCheckBox.SkinID = SkinID; } if (this.chkChecked.Checked) // checked value { oCheckBox.Checked = true; oDesign.HasDefault = true; } else { oCheckBox.Checked = false; oDesign.HasDefault = false; } //bit type string DataType = "bit"; iControlType = Convert.ToInt16(FormDesign.ControlType.CheckBox); // DesignFormField.ModifyDBTable(DBTableName, ControlName, DataType, true, Convert.ToInt16(hidFieldID.Value), Convert.ToInt32(eFormID), oDesign); return (System.Web.UI.Control)oCheckBox; }
protected System.Web.UI.Control CreateImage(string ControlName, out DesignFormField oDesign, Boolean IsUpdate) { oDesign = new DesignFormField(); if (!IsUpdate) { oDesign = oFormField; } oDesign.Width = Convert.ToInt16( this.txtWidth.Text); oDesign.Height = Convert.ToInt16(this.txtHeight.Text); oDesign.CanEnlarge = chkEnlarg.Checked == true ? true : false; oImageControl = (ucImageControl)LoadControl("~/Control/ucImageControl.ascx"); oImageControl.EnlargeImageClientID = this.EnlargeImageClientID; oImageControl.ID = "controlImage" + ControlName; if (txtWidth.Text == string.Empty) { oImageControl.width = sImgWidth; } else { oImageControl.width = Convert.ToInt32(txtWidth.Text); } if (this.txtHeight.Text == string.Empty) { oImageControl.Height = sImgHeight; } else { oImageControl.Height = Convert.ToInt32(txtHeight.Text); } //Set allow enlarge image if (this.chkEnlarg.Checked) { oImageControl.IsEnlarge = true; } else { oImageControl.IsEnlarge = false; } //************************************ //Set permission here oImageControl.IsAllowFileUpload = true; //****************************** // oImage.Width = Unit.Pixel ( sImgWidth); ///oImage.Height = Unit.Pixel(sImgHeight); if (chkImageWithLabel.Checked) { oDesign.Label = txtText.Text; oDesign.WithLabel = true; } //DateTime type. string DataType = "Varchar(500)"; iControlType = Convert.ToInt16(FormDesign.ControlType.Image); // DesignFormField.ModifyDBTable(DBTableName, ControlName, DataType, IsUpdate, Convert.ToInt16(hidFieldID.Value), Convert.ToInt32(eFormID), oDesign ); return (System.Web.UI.Control)oImageControl; }
protected void SetImage(DesignFormField offield) { this.accordionFormDesign.SelectedIndex = 4; AccordionPane oPane = accordionFormDesign.Panes[this.accordionFormDesign.SelectedIndex]; oPane.Enabled = true; txtHeight.Text = offield.Height.ToString(); txtWidth.Text = offield.Width.ToString(); chkEnlarg.Checked = offield.CanEnlarge == true ? true : false; if (offield.WithLabel) { txtText.Text = offield.Label; chkImageWithLabel.Checked = true; } }
protected void SetField( string TabIdentifier , int FormID) { // SetControlPosition(ddlCurrentTab.SelectedValue == string.Empty ? string.Empty : ddlCurrentTab.SelectedValue); // bntFieldAdd.Enabled = false; bntFieldDelete.Enabled = true; DesignFormField oEForm = new DesignFormField(); DesignFormTab oTab = DesignFormTab.GetDataBySysIdentity(FormID, TabIdentifier); if (oTab == null) { return; } Int32 TabID = oTab.FormTabID; if (TabID > 0) { List<DesignFormField> oEFormFieldList = DesignFormField.GetDataBy(TabID, eFormID, Convert.ToInt16(ddlFields.SelectedValue)); if (oEFormFieldList.Count>0) { oEForm = oEFormFieldList.FirstOrDefault(); } } else { List<DesignFormField> oEFormFieldList = DesignFormField.GetDataByeFormID(eFormID, Convert.ToInt16(ddlFields.SelectedValue)); if (oEFormFieldList.Count > 0) { oEForm = oEFormFieldList.FirstOrDefault(); } } if (oEForm != null) { if (ddlFields.SelectedValue == "-1" ) { // IniTextBox(); // bntFieldAdd.Enabled = true ; // bntFieldDelete.Enabled = false; //// bntSaveAllFields.Enabled = false; // foreach (AccordionPane Panes in accordionFormDesign.Panes) // { // Panes.Enabled = true; // } GetNewFieldName(); } else { SetFieldDetail(oEForm); bntSaveAllFields.Enabled = true; } } }
/// <summary> /// Create a new DesignFormField object. /// </summary> /// <param name="formID">Initial value of the FormID property.</param> /// <param name="tabID">Initial value of the TabID property.</param> /// <param name="fieldID">Initial value of the FieldID property.</param> /// <param name="name">Initial value of the Name property.</param> /// <param name="controlLeft">Initial value of the ControlLeft property.</param> /// <param name="controlTop">Initial value of the ControlTop property.</param> /// <param name="labelLeft">Initial value of the LabelLeft property.</param> /// <param name="labelTop">Initial value of the LabelTop property.</param> /// <param name="isReadOnly">Initial value of the IsReadOnly property.</param> /// <param name="isVisible">Initial value of the IsVisible property.</param> /// <param name="isEnabled">Initial value of the IsEnabled property.</param> /// <param name="isDeleted">Initial value of the IsDeleted property.</param> /// <param name="withLabel">Initial value of the WithLabel property.</param> /// <param name="createdBy">Initial value of the CreatedBy property.</param> /// <param name="createdDate">Initial value of the CreatedDate property.</param> public static DesignFormField CreateDesignFormField(global::System.Int32 formID, global::System.Int32 tabID, global::System.Int32 fieldID, global::System.String name, global::System.Int32 controlLeft, global::System.Int32 controlTop, global::System.Int32 labelLeft, global::System.Int32 labelTop, global::System.Boolean isReadOnly, global::System.Boolean isVisible, global::System.Boolean isEnabled, global::System.Boolean isDeleted, global::System.Boolean withLabel, global::System.Int32 createdBy, global::System.DateTime createdDate) { DesignFormField designFormField = new DesignFormField(); designFormField.FormID = formID; designFormField.TabID = tabID; designFormField.FieldID = fieldID; designFormField.Name = name; designFormField.ControlLeft = controlLeft; designFormField.ControlTop = controlTop; designFormField.LabelLeft = labelLeft; designFormField.LabelTop = labelTop; designFormField.IsReadOnly = isReadOnly; designFormField.IsVisible = isVisible; designFormField.IsEnabled = isEnabled; designFormField.IsDeleted = isDeleted; designFormField.WithLabel = withLabel; designFormField.CreatedBy = createdBy; designFormField.CreatedDate = createdDate; return designFormField; }
protected void SetDateTime(DesignFormField offield) { this.accordionFormDesign.SelectedIndex = 3; AccordionPane oPane = accordionFormDesign.Panes[this.accordionFormDesign.SelectedIndex]; oPane.Enabled = true; chkddlMandatory.Checked = offield.IsMandatory == null ? offield.IsMandatory == true ? true : false : false; txtddlMSG.Text = offield.Message == null ? offield.Message : string.Empty; chkWithCalendar.Checked = offield.IsCalendar == false ? false : true; ddlCalendarFormat.SelectedValue = offield.DateFormat; txtDateHeight.Text = offield.Height.ToString(); txtDateWidth.Text = offield.Width.ToString(); if (offield.IsMandatory == true) { chkddlMandatory.Checked = true; txtddlMSG.Text = offield.Message; } else { chkddlMandatory.Checked = false; txtddlMSG.Text = string.Empty ; } }
protected void SetDropDownList(DesignFormField offield) { this.accordionFormDesign.SelectedIndex = 1; AccordionPane oPane = accordionFormDesign.Panes[this.accordionFormDesign.SelectedIndex]; oPane.Enabled = true; radValueList.Checked = offield.IsDataList == false ? true : false; radSQLStatement.Checked = offield.IsDataList == true ? false : true; if (offield.IsDataList == true) { radValueList.Checked = true; radSQLStatement.Checked = false; pnlqueryStatement.Visible = false; pnlList.Visible = true; if ( ddlValueList.Items.Count >0) { ddlValueList.SelectedValue = offield.DataListType.ToString(); } } else { radSQLStatement.Checked = true; radValueList.Checked = false; pnlqueryStatement.Visible = true ; pnlList.Visible = false; txtQuery.Text = offield.QueryStatement != null ? offield.QueryStatement : string.Empty; } }
protected void SetCheckBox(DesignFormField offield) { this.accordionFormDesign.SelectedIndex = 2; AccordionPane oPane = accordionFormDesign.Panes[this.accordionFormDesign.SelectedIndex]; oPane.Enabled = true; chkChecked.Checked = offield.HasDefault == false ? false : true; }
protected void FieldAdd(object sender, EventArgs e) { // SaveAllFields(); SetAllPositions(); GetNewFieldName(); foreach (AccordionPane Panes in accordionFormDesign.Panes) { Panes.Enabled = true; } // SetControlPosition(ddlCurrentTab.SelectedValue == string.Empty ? string.Empty : ddlCurrentTab.SelectedValue); if (!IsAControlbeingSelected()) { return; } if (!IsValidNewField()) { return; }; if (!IsValidControlName(true)) { return; } DesignFormField.checkFieldMax(true, eFormID); if (DesignFormField.error != string.Empty) { Guid oMaxguid = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oMaxguid.ToString(), "callBoxFancy('eFormWarnStatus','" + DesignFormField.error + "');", true); return; } if (lstTabList.SelectedValue == "-1") { Guid oNewTab = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oNewTab.ToString(), "callBoxFancy('eFormWarnStatus','" + ValidationNewTabMessage_Message + "');", true); return; } // ini position string StartPos = "0"; string ControlLeft = "0"; //string ImageStartPos = "10"; //string ImageLeftPos = "300"; DesignFormField oDesign = new DesignFormField(); // get control name and field name System.Web.UI.Control oControl = new System.Web.UI.Control(); System.Web.UI.Control oLabel = CreateLabel(txtLabelName.Text, txtLabelName.Text); oLabel.SkinID = "Editorlabel"; if (this.accordionFormDesign.SelectedIndex == 0) { oControl = CreateTextBox(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 1) { oControl = CreateDropDownList(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 2) { oControl = CreateCheckbox(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 3) { oControl = CreateDate(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 4) { oControl = CreateImage(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } else if (this.accordionFormDesign.SelectedIndex == 5) { oControl = CreateHyperLink(txtTextBoxName.Text, out oDesign, true) as System.Web.UI.Control; } oDesign.Name = txtTextBoxName.Text.Replace(" ", string.Empty); Label oAtLabel = oLabel as Label; if (this.accordionFormDesign.SelectedIndex != 5) { oDesign.Label = oAtLabel.Text; } oDesign.ControlType = iControlType; oDesign.IsVisible = this.chkFieldVisible.Checked == true ? true : false; oDesign.IsEnabled = this.chkFieldEnabled.Checked == true ? true : false; DesignFormTab otab = new DesignFormTab(); if (ddlCurrentTab.SelectedValue != string.Empty) { //add form first if form id is 0 if (eFormID == 0) { DesignForm oform = new DesignForm(); oform.Name = txtFormName.Text; eFormName = txtFormName.Text; oform.Type = 1; DesignForm.Save(oform); eFormID = oform.FormID; } if (Session[SessionTabList] != null) { List<DesignFormTab> oList = Session[SessionTabList] as List<DesignFormTab>; // save all table if form id is 0 foreach (DesignFormTab ot in oList) { if (!DesignFormTab.IsTabNameExist(eFormID, string.Empty, ot.Name)) { //string Tabmsg = ValidationTabNameAlreadyExist_Message; //Guid oTabguid = new Guid(); //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oTabguid.ToString(), "callBoxFancy('eFormWarnStatus','" + Tabmsg + "');", true); if (!ot.IsSysUse) { //return; ot.FormID = eFormID; DesignFormTab.Save<DesignFormTab>(ot); } // update tab list //List<DesignFormTab> oNewList = DesignFormTab.GetDataBy(eFormID); //Session[SessionTabList] = oNewList; } } this.ActiveTabID = ddlCurrentTab.SelectedValue; var otablist = from o in oList where o.SysIdentity == ddlCurrentTab.SelectedValue select o; if (otablist != null && otablist.Count() > 0) { DesignFormTab ofield = otablist.FirstOrDefault(); oDesign.TabID = ofield.FormTabID; oDesign.FormID = eFormID; otab = ofield; } else { oDesign.TabID = 1; } } } else { oDesign.TabID = 1; } oDesign.SkinID = oControl.SkinID; oDesign.IsSearch = false; oDesign.FormID = eFormID; int fieldId = oDesign.FieldID; //Label css position style String cssStyle = string.Empty; cssStyle = FormDesign.ccsRelative + FormDesign.ccsTop + StartPos + FormDesign.ccsPX; cssStyle = cssStyle + FormDesign.ccsLeft + StartPos + FormDesign.ccsPX; int labelLength = txtLabelName.Text.Length + 80; // add control to panel if (CurrentTab != null) { if (this.ddlCurrentTab.SelectedValue != string.Empty) { // DesignFormTab otab = DesignFormTab.GetDataBySysIdentity(eFormID,ddlCurrentTab.SelectedValue); TabPanel oPanel = CurrentTab.FindControl(otab.SysIdentity) as TabPanel; if (oPanel != null) { LiteralControl oLabelLiteral = new LiteralControl(); oLabelLiteral.Text = "<div id=\"DIV" + oControl.ID + "\" Style='" + cssStyle + "' class='" + this.dragcssClass + "' >"; oPanel.Controls.Add(oLabelLiteral); oPanel.Controls.Add(oLabel); LiteralControl oLabelEndLiteral = new LiteralControl(); string endDiv = "</div>"; if ((this.accordionFormDesign.SelectedIndex == 0) && (this.chkMandatory.Checked)) { endDiv = "<span style='Color: red'>*</span></div>"; } oLabelEndLiteral.Text = endDiv; //redefine css style cssStyle = FormDesign.ccsRelative + FormDesign.ccsTop + StartPos + FormDesign.ccsPX; cssStyle = cssStyle + FormDesign.ccsLeft + " " + labelLength.ToString() + FormDesign.ccsPX; oPanel.Controls.Add(oLabelEndLiteral); LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"DIV" + oControl.ID + "\" Style='" + cssStyle + "' class='" + this.dragcssClass + "' >"; // oLabel.Attributes.Add(AppConstManager.cStyle, cssStyle); oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oControl); LiteralControl oEndLiteral = new LiteralControl(); oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); } } } else { CurrentPanel.Controls.Add(oLabel); CurrentPanel.Controls.Add(oControl); } oDesign.ControlLeft = labelLength; oDesign.ControlTop = Convert.ToInt16(StartPos); oDesign.LabelLeft = 0; oDesign.LabelTop = Convert.ToInt16(StartPos); DesignFormField.Save<DesignFormField>(oDesign); Guid gMessage = Guid.NewGuid(); //string sJavascript = "eFormChangeClassForDrag('" + cssDragClass + "', true);editbox_init()"; LoadFieldDetail(); bntFieldAdd.Enabled = false; int count = 0; foreach (ListItem oItem in ddlFields.Items) { if (oItem.Value == oDesign.FieldID.ToString()) { ddlFields.SelectedIndex = count; break; } count++; } hidFieldID.Value = oDesign.FieldID.ToString(); hidControlList.Value = hidControlList.Value + ""; hidLabelList.Value = hidLabelList.Value + ""; string sJavascript = "editbox_init()"; ScriptManager.RegisterStartupScript(this.UpdatePanel1, GetType(), gMessage.ToString(), sJavascript, true); string msg = Action_FieldAdd_Message; CreateFormDesignScript("Main", UpdatePanel1, TabContainer1); IsEnable = true; AccordingIndex = accordionFormDesign.SelectedIndex; string SelectedValue = string.Empty; if (lstTabList.SelectedValue == string.Empty) { SelectedValue = lstTabList.Items[0].Value; } else { SelectedValue = lstTabList.SelectedValue; } SetTab(SelectedValue); if (ddlFields.SelectedValue != "-1") { bntFieldDelete.Enabled = true; } SelectedValue = this.ddlCurrentTab.SelectedValue; TabContainer1.Tabs[1].Enabled = true; bntSaveAllFields.Enabled = true; Guid oguid = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oguid.ToString(), "callBoxFancy('eFormSucessStatus','" + msg + "');", true); }
protected System.Web.UI.Control CreateTextBox(string TextName, out DesignFormField oDesign, Boolean IsUpdate ) { oDesign = new DesignFormField(); if (!IsUpdate) { oDesign = oFormField; } // oDesign.ControlSize = txtSize.Text; oDesign.Width = Convert.ToInt16(this.txtboxWidth.Text); oDesign.Height = Convert.ToInt16( this.txtboxHeight.Text); oDesign.IsReadOnly = ChkReadOnly.Checked == true ? true : false; oDesign.IsMandatory = chkMandatory.Checked == true ? true : false; if (chkMandatory.Checked) { oDesign.Message = txtMSG.Text; } TextBox oTextBox = new TextBox(); oTextBox.ID = "txtEform" + TextName ; oTextBox.ToolTip = oTextBox.ID; oTextBox.Width = Unit.Pixel( Convert.ToInt16(this.txtboxWidth.Text)); oTextBox.Height = Unit.Pixel (Convert.ToInt16(this.txtboxHeight.Text)); oTextBox.SkinID = TextBoxDefaultSkinID; //Nvarchar type. Default size is 100 // string DataType = "nVarchar(" + this.txtSize.Text +")"; iControlType = Convert.ToInt16(FormDesign.ControlType.TextBox); if (this.radMoney.Checked) { // DataType = "Money"; oTextBox.SkinID = TextBoxMoneySkinID; iControlType = Convert.ToInt16(FormDesign.ControlType.Money); } else { if (radTextArea.Checked) { iControlType = Convert.ToInt16(FormDesign.ControlType.TextArea); // DataType = "nText"; oTextBox.TextMode = TextBoxMode.MultiLine; oTextBox.SkinID = TextAreaDefaultSkinID; } if (this.ChkReadOnly.Checked) { oTextBox.SkinID = TextBoxReadOnlySkinID; } if (this.chkMandatory.Checked) { // oTextBox.SkinID = TextBoxMandatorySkinID; } } //modify data if (txtSkin.Text != string.Empty) { oTextBox.SkinID = txtSkin.Text; } // DesignFormField.ModifyDBTable(DBTableName, TextName, DataType, IsUpdate, Convert.ToInt16(hidFieldID.Value), Convert.ToInt32(eFormID), oDesign); return (System.Web.UI.Control)oTextBox; }
protected System.Web.UI.Control CreateHyperLink(string ControlName, ref DesignFormField oFormField) { this.accordionFormDesign.SelectedIndex = 5; oFormField.Message = txtText.Text; oFormField.URL = txtLink.Text; oFormField.NewWindow = chkOpenWindow.Checked == true ? true : false; oFormField.WithLabel = chkWithLabel.Checked == true ? true : false; if (chkWithLabel.Checked) { oFormField.Label = txtContent.Text; } HyperLink oHyperlink = new HyperLink(); oHyperlink.ID = "hyperEform" + ControlName; oHyperlink.ToolTip = oHyperlink.ID; oHyperlink.NavigateUrl = this.txtLink.Text; string DataType = "nVarchar(500)"; iControlType = Convert.ToInt16(FormDesign.ControlType.HyperLink); oHyperlink.SkinID = HyperlinkSkinID; // DesignFormField.ModifyDBTable(DBTableName, ControlName, DataType, false, Convert.ToInt16(hidFieldID.Value), Convert.ToInt16(eFormID), null ); // DesignFormField.checkFieldMax( return (System.Web.UI.Control)oHyperlink; }
protected void SetFieldDetail(DesignFormField offield) { //foreach (AccordionPane Panes in accordionFormDesign.Panes) //{ // Panes.Enabled = false; //} txtTextBoxName.Text = offield.Name; txtLabelName.Text = offield.Label; txtSkin.Text = offield.SkinID == null ? string.Empty: offield.SkinID; chkFieldEnabled.Checked = offield.IsEnabled == true ? true : false; chkFieldVisible.Checked = offield.IsVisible == true ? true : false; bntFieldDelete.Enabled = true; hidFieldID.Value = offield.FieldID.ToString(); switch (offield.ControlType) { case 1: //drop down lsit SetDropDownList(offield); break; case 2: //check box SetCheckBox(offield); break; case 3: //Text box SetTextBox(offield); break; case 4: //List box break; case 5: //Text area SetTextArea(offield); break; case 6: //Literal break; case 7: //Button break; case 8: //Image SetImage(offield); break; case 9: //DateTime SetDateTime( offield); break; case 10: //Money SetMoney(offield); break; case 11: // HyperLink SetHyperLink(offield); break; default: break; } AccordingIndex = accordionFormDesign.SelectedIndex; }
protected System.Web.UI.Control CreateHyperLink(string ControlName, out DesignFormField oDesign, Boolean IsUpdate) { oDesign = new DesignFormField(); if (!IsUpdate) { oDesign = oFormField; } this.accordionFormDesign.SelectedIndex = 5; oDesign.Message = txtText.Text; oDesign.URL = txtLink.Text; oDesign.NewWindow = chkOpenWindow.Checked == true ? true : false; oDesign.WithLabel = chkWithLabel.Checked == true ? true : false; if (chkWithLabel.Checked) { oDesign.Label = txtContent.Text; } HyperLink oHyperlink = new HyperLink(); oHyperlink.ID = "hyperEform" + ControlName; oHyperlink.ToolTip = oHyperlink.ID; oHyperlink.NavigateUrl = this.txtLink.Text; string DataType = "nVarchar(500)"; iControlType = Convert.ToInt16(FormDesign.ControlType.HyperLink); oHyperlink.SkinID = HyperlinkSkinID; // DesignFormField.ModifyDBTable(DBTableName, ControlName, DataType, IsUpdate, Convert.ToInt16(hidFieldID.Value), Convert.ToInt32(eFormID), oDesign); DesignFormField.checkFieldMax(IsUpdate, eFormID); if ( DesignFormField.error != string.Empty ) { Guid oguid = new Guid(); ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), oguid.ToString(), "callBoxFancy('eFormSucessStatus','" + DesignFormField.error + "');", true); } return (System.Web.UI.Control)oHyperlink; }
protected void SetHyperLink(DesignFormField offield) { this.accordionFormDesign.SelectedIndex = 5; AccordionPane oPane = accordionFormDesign.Panes[this.accordionFormDesign.SelectedIndex]; oPane.Enabled = true; txtText.Text = offield.Message; txtLink.Text = offield.URL; chkOpenWindow.Checked = offield.NewWindow == true ? true : false; chkWithLabel.Checked = offield.WithLabel == true ? true : false; if (chkWithLabel.Checked) { txtContent.Text = offield.Label; } }
/// <summary> /// Deprecated Method for adding a new object to the DesignFormFields EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDesignFormFields(DesignFormField designFormField) { base.AddObject("DesignFormFields", designFormField); }
public void SetControlLabel(Control oPanel, DesignFormField oItem, int eFormID) { Label oLabel = new Label(); if (oItem.Label == null) { return; } string LID = oItem.Label.Replace(" ", string.Empty); LID = LID.Replace(":", string.Empty); oLabel.ID = "lblEform" + oItem.Name; //+ oItem.Label oLabel.SkinID = "Controllabel"; oLabel.Text = oItem.Label; oLabel.CssClass = "editText"; int num; string cssStyle = string.Empty; bool IsTop = int.TryParse(oItem.LabelTop.ToString(), out num); if (IsTop == true) { cssStyle = ccsRelative + ccsTop + num.ToString() + ccsPX; } bool IsLeft = int.TryParse(oItem.LabelLeft.ToString(), out num); if (IsLeft == true) { cssStyle = cssStyle + ccsLeft + num.ToString() + ccsPX; } LiteralControl oLiteral = new LiteralControl(); oLiteral.Text = "<Div id=\"LABELDIV" + oLabel.ID + "\" Style='" + cssStyle + "' >"; oPanel.Controls.Add(oLiteral); oPanel.Controls.Add(oLabel); LiteralControl oEndLiteral = new LiteralControl(); if (oItem.IsMandatory == true) { LiteralControl oAddStar = new LiteralControl(); oAddStar.Text = "<span style='color: red;'>*</span>"; oPanel.Controls.Add(oAddStar); } oEndLiteral.Text = "</Div>"; oPanel.Controls.Add(oEndLiteral); }