Example #1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (string.IsNullOrEmpty(EnumType) || string.IsNullOrEmpty(EnumNames) || this.Items.Count > 0)
            {
                return;
            }

            Type  type   = Type.GetType(EnumType, true);
            Array values = Enum.GetValues(type);

            string[] names = EnumNames.Split(',');
            for (int i = 0; i < names.Length; i++)
            {
                if (names[i] != "!")
                {
                    Items.Add(new ListItem(names[i], ((int)values.GetValue(i)).ToString()));
                }

                if (values.GetValue(i).ToString() == SelectedEnum)
                {
                    Items[Items.Count - 1].Selected = true;
                }
            }
        }