如何将数据和dropdownlist绑定
如何将数据和dropdownlist绑定
高手帮忙解答一下啊!
------解决方案-------------------- dropdownlist1.DataSource = 数据源
dropdownlist1.DataTextField = "name ";
dropdownlist1.DataValueField = "id ";
dropdownlist1.DataBind();
------解决方案--------------------dropDownList1.DataValueField = "值字段 ";
dropDownList1.DataTextField = "显示字段 ";
------解决方案--------------------dropDownList1.DataSource = dt;
dropDownList1.DataBind();
------解决方案--------------------for(int i=0;i < dt.Rows.Count;i++)
{
dropDownList1.Items.Add(new ListItem(dt.Rows[i][ " "],dt.Rows[i][ " "]));
}