这是一个常用到的问题,例如将枚举绑定到一个DropdownList……

我是这样实现的:

    public enum BusinessTable
{
商店
= 2,
厂商
= 4,
}

  遍历(在遍历的时候将值添加到一个Dropdownlist上):

    this.ddl业务表名.Items.Add(new ListItem("--请选择--", ""));

foreach (Entity.Common.BusinessTable bt in (BusinessTable[])System.Enum.GetValues(typeof(BusinessTable)))
{
this.ddl业务表名.Items.Add(new ListItem(bt.ToString(), ((int)bt).ToString()));
}

  

相关文章:

  • 2021-05-26
  • 2022-03-05
  • 2021-05-24
  • 2021-06-05
  • 2021-04-08
猜你喜欢
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案