I have an MVC application, I am trying to add a new checkbox to a PartialView, initially I did some tests to make sure that this works correctly and passes the values to the controller, and it did. Then I added a script that blocks some textboxes if the checkbox in question is True, the problem is that they assign the id to the checkbox, the controller no longer receives the value "True" when I check. I thought it might be the script I wrote that was causing problems, so I mentioned it, but it still doesn't work, as soon as I remove the id from the checkbox it works again. How can I fix this?
<div class="col-md-4" id="container">
<label class="lblForm"> @Html.LabelFor(model => model.OnBds, "On BdS ", new { id = "BDS" })</label>
<div class="d-flex">
@Html.CheckBoxFor(model => model.OnBds , new { @onChange = "ValueCheck", id = "BDSCh" })
</div>
</div>
I also tried to insert a HiddenFor and assign it the value True through a script, but that didn't work either
Is it a single checkbox? and you have attach a fixed ID to the checkbox, doesn't it help and how new IDs are attached to it? It will be helpful if you could share debug image of your page using chrome or firefox developer tools