当我将数据源应用于DropDownList时,选择了System.Data.DataRowView ...如何获取应用数据源的数据?

时间:2021-08-31 16:18:12

'System.Data.DataRowView' is added in dropdownlist.. If applied data contains 5 records then it appears 5 times in list help....

'System.Data.DataRowView'被添加到下拉列表中。如果应用的数据包含5条记录,那么它在列表帮助中出现5次....

1 个解决方案

#1


0  

Assign the column names of data source to DataTextField and DataValueField of the dropdownlist.

将数据源的列名分配给下拉列表的DataTextField和DataValueField。

E.g.

ddl.DataTextField = "TextColumnName";
ddl.DataValueField = "ValueColumnName";
ddl.DataSource = dt;
ddl.DataBind();

#1


0  

Assign the column names of data source to DataTextField and DataValueField of the dropdownlist.

将数据源的列名分配给下拉列表的DataTextField和DataValueField。

E.g.

ddl.DataTextField = "TextColumnName";
ddl.DataValueField = "ValueColumnName";
ddl.DataSource = dt;
ddl.DataBind();