mercredi 30 septembre 2015

Disabling checkbox in mvc does not submit values to database

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"})
        @Html.ValidationMessageFor(m => m.FirstName)
    </td>
</tr>




Aucun commentaire:

Enregistrer un commentaire