I am getting null value by selecting dropdownlist item in controller.[I saw by doing in debug mode]
Here is my code
Controller
public ActionResult Index()
{
var jobStatusList = new SelectList(new[]
{
new { ID = "1", Name = "Full Time" },
new { ID = "2", Name = "Part Time" },
},
"ID", "Name", 1);
ViewData["JobStatusList"] = jobStatusList;
}
public ActionResult Create(StaffRegistrationViewModel staffRegistrationViewModel)
{
//Here is my code
}
View
@using (Html.BeginForm("Create", "StaffRegistration", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.DropDownList("jobStatusList",ViewData["JobStatusList"] as SelectList)
}
In staffRegistrationViewModel getting null value in Status field.
Thank You