Try Now
More in this section

Forums / General Discussions / I have create enum type property but it is not design a drop down list

I have create enum type property but it is not design a drop down list

3 posts, 0 answered
  1. Suyash
    Suyash avatar
    1 posts
    22 Feb 2013
    02 Apr 2013
    Link to this post
    below is the property which i was define,
    please find the attached screen shots where I am only getting first value of enum property in text box.

     public ColorType Color { get; set; }
     public enum ColorType { Black, Blue, Red, Green, Purple, Gray, Yellow }

    I am using sitefinity version 5.2.

    actually I want property data appear in drop down list when i clicked at usercontrol edit option.
  2. Daniel Plomp
    Daniel Plomp avatar
    952 posts
    18 Feb 2004
    02 Apr 2013 in reply to Suyash
    Link to this post
    Hi Suyash,

    You could try to use this code to bind to the DropDownList:

    Array itemValues = System.Enum.GetValues(typeof(ColorType));
    Array itemNames = System.Enum.GetNames(typeof(ColorType));
    for (int i = 0; i <= itemNames.Length - 1 ; i++) {
        ListItem item = new ListItem(itemNames[i], itemValues[i]);

    Kind regards,
  3. Stefani Tacheva
    Stefani Tacheva avatar
    718 posts
    19 Oct 2016
    04 Apr 2013
    Link to this post

    Thank you Danie for sharing a solution. I hope that Suyash will find it useful.

    Stefani Tacheva
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
3 posts, 0 answered