Reputation: 1530
View Code:
@Html.DropDownListFor(m => m.mode, new List<SelectListItem>
{
{
new SelectListItem{ Text="Select", Value = "10000" },
new SelectListItem{ Text="Add", Value = "10001" },
new SelectListItem{ Text="Modify", Value="10002" }
}, htmlAttributes: new { @class = "form-control", @id = "cboFunctions", @onChange = "FunctionChange();" })
after disabled by java-scrip code its not passing value from view to controller.
$("#cboFunctions").prop("disabled", true);
i'm also try store value in hidden field but not passing value
any help would be appreciated Thanks.
Upvotes: 0
Views: 1345
Reputation: 247038
While unclear why the dropdown is being disabled, it has already been mentioned that disabled inputs do not send data.
You would need to add a hidden
input for that property for it to be forwarded on to the server when the form is posted.
@Html.HiddenFor(m => m.mode)
So as you are using java script you can set the hidden input with the locked in value so that it get posted.
Upvotes: 1