指定DropDownList使用的数据源

DropDownList1.DataSource = dataSet.Tables["Table1"].DefaultView;

//指定DropDownList使用的表里的那些字段

DropDownList1.DataTextField = "ItemName"; //dropdownlist的Text的字段

DropDownList1.DataValueField = "id";//dropdownlist的Value的字段

DropDownList1.DataBind();

posted on 2009-04-15 10:55  tongdengquan  阅读(136)  评论(0编辑  收藏  举报