0

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.

juvchan
  • 6,113
  • 2
  • 22
  • 35
Secret Star
  • 27
  • 1
  • 6

0 Answers0