Link to home
Start Free TrialLog in
Avatar of timmyt851
timmyt851

asked on

filtering duplicate records from dataset

I have a datagrid filled with a dataset, and some drop-down lists that I use to filter the rows based on certain columns. It's easy enough to fill the drop-downs with all of the possible values for a column with its own select statement, but we really want to only list items that are available in the dataset - so I just set the dropdown list's datasource to the datagrid's dataset with DataTextField and DataValueField set to the appropriate columns in the dataset. But now I get a lot of duplicates since several rows in the dataset contain the same values for that particular column - how do you remove the dups from a list? I tried duplicating the datatable and removing all columns except the 2 I need for the drop-down, then adding a RowFilter of "DISTINCT" to its DefaultView but that didn't work. I sure wish you could just query a dataset or datatable - "SELECT DISTINCT column1,column2 FROM mydataset"... I would use SQL to do this but the dropdown contents will change when users filter the datagrid so most of the filtering is done in the master dataset with RowFilter, the entire contents are loaded on page load and after that it's all in ViewState.
ASKER CERTIFIED SOLUTION
Avatar of timmyt851
timmyt851

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bob Learned
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

PAQ/Refund

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

TheLearnedOne
EE Cleanup Volunteer