I am populating a dropdownlist from database. Table has some duplicate records in it. I want the dropdownlist to have distinct results. I have tried following code.
model.Specialization = _SpecializationRepository.GetAll().Distinct().Select(x =>
new SelectListItem
{
Value = x.SpecializationId.ToString(),
Text = x.Description
});
Its taking all the rows from database and displaying it in dropdownlist.