Is it that if a checkbox is disabled, the value does not get submitted to the database? I have disabled a checkbox so that even if the user does not enter any values in the rest of the form, atleast one value will be submitted. But when I click on the submit button there is no entry in the database. Please Help
<table class="table-bordered">
<tr>
<td colspan="2">
@Html.CheckBoxFor(m => m.isUsed, new { @disabled="disabled"})
</td>
</tr>
<tr>
<td>
@Html.TextBoxFor(m => m.FirstName, @Model.isUsed ? (object)new { @class = "form-control" } : new { @class = "form-control", @disabled = "disabled" })
@Html.ValidationMessageFor(m => m.FirstName)
</td>
</tr>
falsewill always be posted because of the associated hidden input generated byCheckBoxFor()TextBoxFor()method generates identical html attributes so unclear what that is for.@Html.TextBoxFor(m => m.FirstName, @Model.isUsed ? (object)new { @class = "form-control" } : new { @class = "form-control", @disabled = "disabled" })TextBoxFor()method. Just include@Html.HiddenFor(m => m.isUsed)so the value posts back and manually create a checkbox<input type="checkbox" disabled>if you really need to show a checkbox