protected void btnSave_ServerClick(object sender, EventArgs e) { Page.Validate(); if (!Page.IsValid) { return; } FormController fc = new FormController(FormDocumentData); if (!_add && FormItemData != null) //edit { FormItemData = fc.GetSTLItemByUid(new Guid(itemUid)); FormItemData.ShowLabel = !rbNone.Checked; FormLabel lbl = null; foreach (FormLabel temp in FormItemData.Labels) { if (temp.Code.ToLower().Equals(Thread.CurrentThread.CurrentUICulture.Name.ToLower())) { lbl = temp; } } if (lbl == null) { lbl = new FormLabel(); lbl.Code = Thread.CurrentThread.CurrentUICulture.Name.ToLower(); FormItemData.Labels.Add(lbl); } if (rbDefault.Checked) { lbl.Title = FormController.DefaultLabelValue; } else { lbl.Title = txtTitle.Text; } if (!String.IsNullOrEmpty(txtLabelWidth.Text)) { FormItemData.LabelWidth = Unit.Pixel(int.Parse(txtLabelWidth.Text)).ToString(); } short tabIndex = 0; if (!String.IsNullOrEmpty(TabIndexText.Text.Trim())) { tabIndex = short.Parse(TabIndexText.Text.Trim()); } FormItemData.TabIndex = tabIndex; FormItemData.RowSpan = int.Parse(ddRows.SelectedValue); if (!rb1.Disabled && rb1.Checked) { FormItemData.ColSpan = 1; } if (!rb2.Disabled && rb2.Checked) { FormItemData.ColSpan = 2; } foreach (Control c in phProperties.Controls) { if (c is SmartTableLayoutItemProperties) { SmartTableLayoutItemProperties sp = (SmartTableLayoutItemProperties)c; //FormItemData.Control.Source = sp.Source; FormItemData.Control.ReadOnly = sp.ReadOnly; } } } else if (_add && FormSectionData != null) { FormSectionData = fc.GetSectionByUid(new Guid(FormSectionData.Uid)); if (ddControl.SelectedValue.Equals(FormController.MetaPrimitiveControlType)) { string source = String.Empty; bool readOnly = false; foreach (Control c in phProperties.Controls) { if (c is SmartTableLayoutItemProperties) { SmartTableLayoutItemProperties sp = (SmartTableLayoutItemProperties)c; source = sp.Source; readOnly = sp.ReadOnly; } } int colSpan = 1; if (!rb1.Disabled && rb1.Checked) { colSpan = 1; } if (!rb2.Disabled && rb2.Checked) { colSpan = 2; } string label = String.Empty; if (rbDefault.Checked) { label = FormController.DefaultLabelValue; } else if (rbCustom.Checked) { label = txtTitle.Text; } short tabIndex = 0; if (!String.IsNullOrEmpty(TabIndexText.Text.Trim())) { tabIndex = short.Parse(TabIndexText.Text.Trim()); } FormItem newItem = FormController.CreateFormItemPrimitive(-1, -1, int.Parse(ddRows.SelectedValue), colSpan, !rbNone.Checked, label, Unit.Pixel(int.Parse(txtLabelWidth.Text)), tabIndex, source, readOnly); fc.AddFormItem(newItem, new Guid(FormSectionData.Uid)); } } string newUid = Guid.NewGuid().ToString("N"); Session[newUid] = FormDocumentData; CloseAndRefresh(newUid); }