I have create enum type property but it is not design a drop down list
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.
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);
Hello,
Thank you Danie for sharing a solution. I hope that Suyash will find it useful.
Regards,
Stefani Tacheva
the Telerik team