public static IList<MyTestStatus> CreateMyTestStatusList()
{
List<MyTestStatus> status = new List<MyTestStatus>();
status.Add(new MyTestStatus() { Name = "1" });
status.Add(new MyTestStatus() { Name = "2" });
status.Add(new MyTestStatus() { Name = "3" });
status.Add(new MyTestStatus() { Name = "4" });
return status.ToList();
}
@Html.DropDownListFor(model => model.MyTestStatus, new SelectList(Model._MyTestViewModel.MyTestStatus), "Select.....", new { @class = "form-control"})
i have this code for dropdownlistfor i want the selected value by default to be "4" or the selected value which the user select,i used jQuery
$("#MyTestStatus").val("4");
when the page load is displaying "4" as i want,but in update the value will always display as "4" even if select a different value.