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()));
            }

posted @ 2010-04-21 16:44  smodi  阅读(685)  评论(0编辑  收藏  举报