DropDownList绑定枚举类型值与绑定数据列名称


this.DropDownList.DataSource = Enum.GetNames(typeof(MyEnum));

this.DropDownList.DataBing();

 

    //dropdownList绑定数据列名

            DataSet ds = GetDataSource();
            for (int i = 0; i < ds.Tables[0].Columns.Count; i++)
            {
                this.ddlXValue.Items.Add(new ListItem(ds.Tables[0].Columns[i].ColumnName.ToString(),i.ToString()));
                this.ddlYValue.Items.Add(new ListItem(ds.Tables[0].Columns[i].ColumnName.ToString(), i.ToString()));
            }

你可能感兴趣的:(list)