准备实现两个dropdownlist二级联动的功能:
在一个dropdownlist 绑定过数据源之后显示,system.data.datarowview,无法显示从数据库中查询到的值。
原因是:
DropDownList4.DataTextField没有绑定。
错误的代码:
DataTable dt1 = new DataTable();
dt1 = get1("name");
DropDownList4.DataSource = dt1;
DropDownList4.DataBind();
修改后的代码:
DataTable dt1 = new DataTable();
dt1 = get1("name");
DropDownList4.DataSource = dt1;
DropDownList4.DataTextField = "name";
DropDownList4.DataBind();
错误就解决了