示例#1
0
        private void BindData()
        {
            if (MetaField != null && !MetaField.AllowNulls)
            {
                RequiredFieldValidator1.Enabled = true;
            }
            else
            {
                RequiredFieldValidator1.Enabled = false;
            }

            MetaLabelCtrl.Text = String.Format("{0} ({1})", MetaField.FriendlyName, LanguageCode);

            MetaDescriptionCtrl.Text             = MetaField.Description;
            RequiredFieldValidator1.ErrorMessage = String.Format("the {0} field is required", MetaField.FriendlyName);

            if (MetaField.AllowNulls)
            {
                DicSingleValueCtrl.Items.Add(new ListItem("[" + RM.GetString("SINGLEVALUECONTROL_EMPTY_VALUE") + "]", ""));
            }

            MetaDictionary dictionary = MetaField.Dictionary;

            if (dictionary != null)
            {
                foreach (MetaDictionaryItem item in dictionary)
                {
                    DicSingleValueCtrl.Items.Add(new ListItem(item.Value.ToString(), item.Value.ToString()));
                }
            }

            if (DicSingleValueCtrl.Items.Count > 0)
            {
                try
                {
                    ManagementHelper.SelectListItem(DicSingleValueCtrl, MetaObject.GetDictionaryItem(MetaField).Value);
                }
                catch
                {
                }
            }
        }