I have one form and in that one dropdown is in disabled status as per below :
<div class="form-group">
<label asp-for="ItemEditModel.ProjectJobId" class="form-label required"></label>
<div class="form-group">
<select class="form-control" asp-for="ItemEditModel.ProjectJobId"
asp-items="Model.ProjectJobList" disabled></select>
</div>
<span class="text-danger" asp-validation-for="ItemEditModel.ProjectJobId"></span>
</div>
Now when we submit form then this field’s value is not coming as it is in disabled state so.
Any idea how can I get this fields value when we submit form.
2
Answers
Use Readonly Attribute instead of disabled
You can try to use route parameter:
Or you can try to remove
disabled
before form submitting:Or you can add a hidden input to bind
ItemEditModel.ProjectJobId
: