I’m using a function to return a number of years calculated from a datetime column, and am having trouble figuring out how to reference the calculated column when trying to populate a dropdown.
Here is my Linq query:
var q = (from a in db.Applications
where a.uID == ID
select a.date.Year).Distinct();
return q.ToList();
So, when I go to populate the dropdown…
Dropdown1.DataTextField = ?????
When a list of value types is used as the DataSource, the
DataTextFieldandDataValueFieldproperties do not need to be set.See below:
The dropdown would then be initialized like this: