The following is my code…
DropDownList2.DataSource = td.DataSet
DropDownList2.DataSource = td
DropDownList2.DataTextField = td.Columns("Name").ColumnName.ToString
DropDownList2.DataValueField = td.Columns("VendorCode").ColumnName.ToString
DropDownList2.DataBind()
Now I have a requirement to show the type of vendor and the Name of the vendor on the dropdownlist. The type of vendor can be retreived with this statement…
td.Columns("VendorType").ColumnName.ToString
Is it possible to do this? Please help
Best Solution
Not possible to bind DataTextField to more than one column. You can create a derived column containing Vendor Name and Vendor Type and bind it to DataTextField property.