Remove Duplicates From Bound Combobox

JasonWinn used Ask the Experts™
I am using a third party combobox (telerik) but it functions very similair to a regular combobox.

My problem is I have the combobox bound to a datasource, but I cannot do a DISTINCT query because not all rows are unique.

example of my sql table:

Col_1     Col_2      Col_3      Col_4
  hi           hey       yo           hey
  yo          hi          yo           hi

Lets say the combobox is bound to Col_3, Distinct wont work. and it will display two entries of "Yo" in the combobox.

any idea's on how to only display unique items "Col_3".

In my real table I have about 20 columns and each 20 combobox's is bound to a different
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You could create an ArrayList (or a List<String> of you're using .NET 2.0) and bind to the arraylist:

ArrayList myList = new ArrayList()
foreach(DataRow row in myDataTable)
  string value = row["Col_3"].ToString();

combobox.DataSource = myList; // or whatever syntax is used for binding the combobox

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial