Friday, July 16, 2010

Bind a DropDownList in ASP.NET to an enum

It is quite common to bind a DropDown control in an ASP.NET page to an Enum. the right syntax is
 ddlWeekDays.DataSource = Enum.GetNames(typeof(EnumWeekDays)); ddlWeekDays.DataBind();

No comments:

Post a Comment