I started using MVC after a long time and now I am unable to do some things really easy.
Model class:
public class TaskDetails
{
public string ProjectID { get; set; }
public string ProjectName { get; set; }
public DateTime StartDate { get; set; }
public DateTime EstimatedDate { get; set; }
public string TaskDescription { get; set; }
}
Controller:
List<SelectListItem> query = DE.tblEmployees
.Select(c => new SelectListItem { Text = c.Name, Value = c.Name })
.ToList();
ViewBag.Categories = query;
return View();
View:
<div class="dropdown">
@Html.DropDownList("CategoryID", (List<SelectListItem>)ViewBag.Categories, "--User Name--")
</div>
This is the source and its working perfectly, but what I want to do is to hide all specific options in dropdown where Value != NewTask
NewTask?