When Dropdownlitfor Is Disabled , Value Always Passed As 0
This is my dropdownlistFor @Html.DropDownListFor(m => m.objTicket.DepartmentId, new SelectList(Model.objTicket.Departments, 'DepartmentId', 'Department'), '-- Select Department
Solution 1:
Form fields are submitted using Names instead of Ids. Disabled controls values wont be submitted by browsers. Place a @Html.HiddenFor
field with same name and different Ids as given below.
@Html.DropDownListFor(m => m.objTicket.DepartmentId, new SelectList(Model.objTicket.Departments, "DepartmentId", "Department"),Department--", new { id = "Deptment"}, disabled="disabled")
@Html.HiddenFor(m => m.objTicket.DepartmentId, new { id="Deptment2" })
Post a Comment for "When Dropdownlitfor Is Disabled , Value Always Passed As 0"