Exemplo n.º 1
0
 protected override void OnLoad(EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.EnumType))
     {
         Type type = Type.GetType(this.EnumType);
         Enum.GetUnderlyingType(type);
         foreach (object obj in Enum.GetValues(type))
         {
             string value = obj.ToString();
             if (string.IsNullOrEmpty(this.AvailabeValues) || this.AvailabeValues.Split(new char[]
             {
                 ','
             }).Any((string each) => each.Equals(value, StringComparison.InvariantCultureIgnoreCase)))
             {
                 string   value2 = this.localizedText ? LocalizedDescriptionAttribute.FromEnum(type, obj) : obj.ToString();
                 ListItem item   = new ListItem(RtlUtil.ConvertToDecodedBidiString(value2, RtlUtil.IsRtl), value);
                 this.Items.Add(item);
                 if (this.DefaultValue != null && value == this.DefaultValue)
                 {
                     this.SelectedValue = value;
                 }
             }
         }
     }
     base.OnLoad(e);
 }
Exemplo n.º 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            List <CountryInfo> list = new List <CountryInfo>(CountryInfo.AllCountryInfos);

            list.Sort();
            if (!this.SkipEmptyCountry)
            {
                this.Items.Add(new ListItem(string.Empty, string.Empty));
            }
            bool isRtl = RtlUtil.IsRtl;

            foreach (CountryInfo countryInfo in list)
            {
                this.Items.Add(new ListItem(RtlUtil.ConvertToDecodedBidiString(countryInfo.LocalizedDisplayName, isRtl), countryInfo.Name));
            }
        }