Exemplo n.º 1
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void BindData()
        {
            if (_mc == null)
            {
                ddlOwnerType.Items.Add(new ListItem(GetGlobalResourceObject("GlobalMetaInfo", "Private").ToString(), OwnerTypes.Private.ToString()));
                ddlOwnerType.Items.Add(new ListItem(GetGlobalResourceObject("GlobalMetaInfo", "Public").ToString(), OwnerTypes.Public.ToString()));

                txtFieldName.Text         = "Title";
                txtFieldFriendlyName.Text = "Title";
                txtMaxLen.Text            = "100";

                txtClassName.Attributes.Add("onblur", "SetName('" + txtClassName.ClientID + "','" + txtClassFriendlyName.ClientID + "','" + vldClassFriendlyName_Required.ClientID + "')" + "; SetName('" + txtClassName.ClientID + "','" + txtClassPluralName.ClientID + "','" + vldClassPluralName_Required.ClientID + "')");
                txtFieldName.Attributes.Add("onblur", "SetName('" + txtFieldName.ClientID + "','" + txtFieldFriendlyName.ClientID + "','" + vldFieldFriendlyName_Required.ClientID + "')");
            }
            else
            {
                // Class
                txtClassName.Text    = _mc.Name;
                txtClassName.Enabled = false;

                txtClassFriendlyName.Text = _mc.FriendlyName;
                txtClassPluralName.Text   = _mc.PluralName;

                string ownerType = _mc.Attributes.GetValue <OwnerTypes>(MetaDataWrapper.OwnerTypeAttr, OwnerTypes.Undefined).ToString();
                ddlOwnerType.Items.Add(new ListItem((string)GetGlobalResourceObject("GlobalMetaInfo", ownerType), ownerType));
                ddlOwnerType.Enabled = false;

                chkSupportsCards.Checked = _mc.SupportsCards;
                chkSupportsCards.Enabled = false;

                // Field
                MetaField mf = MetaDataWrapper.GetTitleField(_mc);

                txtFieldName.Text    = mf.Name;
                txtFieldName.Enabled = false;

                txtFieldFriendlyName.Text = mf.FriendlyName;

                txtMaxLen.Text    = string.Format(CultureInfo.CurrentUICulture, "{0}", mf.Attributes[McDataTypeAttribute.StringMaxLength]);
                txtMaxLen.Enabled = false;
            }
        }