Issue encountered in .net framework 4.0
I have 2 dropdownlist currently with one for months selection and another for year selection.
Both of their datasource are a datatable from a SQL which returns rows with year and month as columns. I then use the datatextfield and datavaluefield to specify which column to be used. Example:
string sql = "select.... group by...";//the query
DataTable dtMonthYear = db.getDataTable(sql); //got the datatable
ddlMonth.DataSource = dtMonthYear;
ddlMonth.DataTextField = "Month";
ddlMonth.DataValueField = "Month";
ddlMonth.DataBind();
ddlYear.DataSource = dtMonthYear;
ddlMonth.DataTextField = "Year";
ddlMonth.DataValueField = "Year";
ddlYear.DataBind();
Because of that, the year will have duplicated items in it, and i wish to eliminate the duplicated items.
I'd found out that linq can do it but unfortunately my framework is until 4.0 only and can't use the datarowextension. Here's the link that i got: LINQ query on a DataTable
Anyone has other idea?
Thanks