Saturday, 6 August 2016

Bind static dropdownlist in MVC

No comments
Model


public string patientStatus { get; set; }
public List<SelectListItem> Status
        {
            get {
                return new List<SelectListItem>
                {
                    new SelectListItem { Text="All",Value="All"},
                    new SelectListItem { Text="Active",Value="Active"},
                    new SelectListItem { Text="In Active",Value="In Active"}
                };
            }

        }


@Html.DropDownListFor(x => x.patientStatus, Model.Status, new { @class="form-control"})