标签:
public partial class Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { GetListType(); } private void GetListType() { DropDownListMenu.Items.Clear(); DropDownListMenu.DataSource = ListTypeForEnum(); DropDownListMenu.DataValueField = "Value"; DropDownListMenu.DataTextField = "Text"; DropDownListMenu.DataBind(); } public static IList ListTypeForEnum() { ArrayList list = new ArrayList(); foreach (int i in Enum.GetValues(typeof(EnumActivityType))) { ListItem listitem = new ListItem(Enum.GetName(typeof(EnumActivityType), i), i.ToString()); list.Add(listitem); } return list; } public enum EnumActivityType { Task = 344, Fax = 345, Phone = 346, Email = 347, Reminder = 348, Appointment = 349, Expiration = 350, Inquiry = 367 } }
标签:
原文地址:http://www.cnblogs.com/xiaomen/p/5647491.html