Why do I get System.Data.DataRowView/System.Data.Common.DbDataRecord as the item in a dropdownlist

Platform: ASP.NET| Category: Dropdownlist

This is probably because you have not set the DataTextField/ DatavalueField property of the dropdownlist.

VB.NET


’..
DropDownList1.DataSource = ds.Tables(0)
DropDownList1.DataTextField = 'CategoryName'
DropDownList1.DataValueField = 'CategoryId'
DropDownList1.DataBind()

C#


//..
DropDownList1.DataSource =ds.Tables[0];
DropDownList1.DataTextField = 'CategoryName';
DropDownList1.DataValueField = 'CategoryId';
DropDownList1.DataBind();

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.