Search Results

Search found 1 results on 1 pages for 'user2976270'.

Page 1/1 | 1 

  • Remove duplication's from my DropDownList

    - by user2976270
    In my controller i am returning list of my object with specific property: public ActionResult Index() { List<MyObject> list = db.MyObjects.Where(x => x.family == "Web").ToList(); ViewBag.Files = new SelectList(list, "Id", "protocol"); return View(); } This is my object: public class MyObject { public int id { get; set; } public string fileName { get; set; } public string browser { get; set; } public string protocol { get; set; } public string family { get; set; } } Index.cshtml: @Html.DropDownList("File", new SelectList(ViewBag.Files, "Id", "protocol_site"), "Select webmail site", new { style = "vertical-align:middle;" }) And i try to made 2 changes with no succeed: Remove all the duplication protocol from my DropDownListfor exapmle if i have 10 objects : 9 is doc protocol and 1 pdf i wand to see in my DropDownList only 2 items: DOC and PDF and not all the 10 items. Sort this DropDownList in alphabet order

    Read the article

1