Mark Tabor

Mark Tabor

  • 572
  • 1.9k
  • 431k

how to send a dropdown value to controller in mvc5

Aug 19 2019 5:14 AM
As i have my view in razor and it is strongly type view so without using dropdownlistfor it is not getting the value and shows 0 all the time on post.
 
so i need to use dropdownlistFor
 
@Html.DropDownList("Designation_Id", new SelectList(ViewBag.Designation, "Designation_Id", "Designation_Text"), "Please select", new { @id = "ddlDesignation", @class = "btn form-text" })
 
how can i write the above state for dROPDOWNLISTFOR or can i send the value of dropdown using dropdownlist to the controller as my controller is taking an object class like below kindly assits me
 

Answers (9)