Hi all, i have a problem like that; table1 PortNo Supplier ... 1 -------s1 2 -------s1 3 -------s2 4 -------s3 5 -------s4 6 -------s5 when i use DropdownList to hold the DataTextField "Supplier", it always shows all the data in the DropdownList,including "Duplicate s1". but i don't want to show the s1 twice in the DropdownList. How can i achieve that? code: DropDownList1.DataSource = ds.Tables["Table1"].DefaultView; DropDownList1.DataTextField = "Supplier";
When setting up the SQL for the datasource, use the distinct keyword : Select distinct supplier from Table1
surely supplier is normalised out into another table? If so setup another datasource to populate your list.
maybe you should clean out your table? Distinct is an extra step to the processor, especially when it's not needed. Create a new table, copy over the data using DISTINCT, then bring it back to clean out dupes. Then you can do a straight up Select.