/// <summary> /// Binds the data. /// </summary> private void BindData() { MetaField field = null; if (AttributeId > 0) { field = MetaField.Load(MDContext, AttributeId); } BindTypes(); if (field != null) { this.tbName.Text = field.Name; this.tbFriendlyName.Text = field.FriendlyName; this.tbDescription.Text = field.Description; chkAllowNulls.Checked = field.AllowNulls; chkAllowSearch.Checked = field.AllowSearch; chkIsEncrypted.Checked = field.IsEncrypted; chkSaveHistory.Checked = field.SaveHistory; chkMultiLanguage.Checked = field.MultiLanguageValue; if (CanBeCompared(field.DataType)) { chkUseInComparing.Enabled = true; if (field.Attributes["UseInComparing"] != null) { this.chkUseInComparing.Checked = Boolean.Parse(field.Attributes["UseInComparing"]); } else { this.chkUseInComparing.Checked = false; } } else { chkUseInComparing.Enabled = false; } if (field.AllowSearch) { IndexStored.Enabled = true; if (field.Attributes["IndexStored"] != null) { this.IndexStored.Checked = Boolean.Parse(field.Attributes["IndexStored"]); } else { this.IndexStored.Checked = false; } if (field.Attributes["IndexField"] != null) { ManagementHelper.SelectListItem(IndexOptionsList, field.Attributes["IndexField"]); } } string clientOption = field.Attributes["ClientOption"]; if (clientOption != null && clientOption.Length > 0) { chkClientOption.Checked = Boolean.Parse(clientOption); } ManagementHelper.SelectListItem(ddlType, GetTypeId(field.DataType).ToString()); this.tbName.Enabled = false; this.ddlType.Enabled = false; chkAllowNulls.Enabled = false; chkMultiLanguage.Enabled = false; //chkAllowSearch.Enabled = false; chkSaveHistory.Enabled = AllowSaveHistory(field.DataType); chkMultiLanguage.Enabled = chkSaveHistory.Enabled; InitDataTypeUI(field.DataType); string confirm = "return confirm('" + RM.GetString("ATTRIBUTEEDIT_REMOVE_CONFIRMATION") + "')"; //DeleteButton.Attributes.Add("onclick", confirm); // make delete button invisible if attribute cannot be deleted EditSaveControl.ShowDeleteButton = field.OwnerMetaClassIdList.Count > 0 ? false : true; if (field.IsSystem || field.Namespace.Contains("System")) { EditSaveControl.ShowDeleteButton = false; } // Decimal and Numeric properties if (field.DataType == MetaDataType.Decimal || field.DataType == MetaDataType.Numeric) { tbPrecision.Text = ManagementHelper.GetStringValue(field.Attributes["MdpPrecision"], "38"); tbScale.Text = ManagementHelper.GetStringValue(field.Attributes["MdpScale"], "0"); tbPrecision.ReadOnly = true; tbScale.ReadOnly = true; } // Image properties if (field.DataType == MetaDataType.ImageFile || field.DataType == MetaDataType.Image) { chkAutoResizeImage.Checked = ManagementHelper.GetBooleanValue(field.Attributes["AutoResize"], false); ImageWidth.Text = ManagementHelper.GetStringValue(field.Attributes["ImageWidth"], ""); ImageHeight.Text = ManagementHelper.GetStringValue(field.Attributes["ImageHeight"], ""); chkStretchImage.Checked = ManagementHelper.GetBooleanValue(field.Attributes["StretchImage"], false); chkAutoGenerateThumbnail.Checked = ManagementHelper.GetBooleanValue(field.Attributes["CreateThumbnail"], false); ThumbnailWidth.Text = ManagementHelper.GetStringValue(field.Attributes["ThumbnailWidth"], ""); ThumbnailHeight.Text = ManagementHelper.GetStringValue(field.Attributes["ThumbnailHeight"], ""); chkStretchThumbnail.Checked = ManagementHelper.GetBooleanValue(field.Attributes["StretchThumbnail"], false); } chkIsEncrypted.Enabled = IsEncryptionType(field.DataType); if (!IsDictionaryType(field.DataType)) { ManagementHelper.SelectListItem(ddlType, GetTypeId(field.DataType).ToString()); } else { ManagementHelper.SelectListItem(ddlType, 0); //ShowDictionaryRows(true); BindDictionary(); } } else { EditSaveControl.ShowDeleteButton = false; //ShowDictionaryRows(false); } chkMultiline.Visible = false; chkEditable.Visible = false; }