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

Posted by Community Admin on 03-Aug-2018 10:28

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

All Replies

Posted by Community Admin on 02-Apr-2013 00:00

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.

Posted by Community Admin on 02-Apr-2013 00:00

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]);
    dropdownlist.Items.Add(item);

Kind regards,
Daniel

Posted by Community Admin on 04-Apr-2013 00:00

Hello,

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

Regards,
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

This thread is closed