一个DropDwon和ListBox 绑定一个Enum的示例:代码如下所示:

1.选创一个Enum:

enum Speen
        { Low = 1, Mdeim = 2, High = 3 }

2.绑定数据:

protected void Page_Load(object sender, EventArgs e)
      {
          DropDownList1.DataSource = Enum.GetValues(typeof(Speen));
          DropDownList1.DataBind();
          ListBox1.DataSource = Enum.GetValues(typeof(Speen));
          ListBox1.DataBind();
      }

3.运行结果如下:

Enum 作为一个数据源绑定

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-15
  • 2022-02-08
猜你喜欢
  • 2021-12-22
  • 2021-08-24
  • 2022-12-23
  • 2021-10-17
  • 2022-12-23
  • 2021-11-06
  • 2022-12-23
相关资源
相似解决方案