I have this piece of code in my View which belongs to a form
<div class="col-md-10">
@foreach (var l in leads)
{
@: @Html.CheckBox("cbLead", false, new { @value = @l.Id }) @Html.TextBox("worth", "") - @Html.Label(l.Name)
}
</div>
And this is the form with I handle the post:
[HttpPost]
public ActionResult Update(string[] cbLead, double[] worth)
{
// code
}
I have 24 checkboxes, but for each checkbox selected I receive 2 values in the Update method. So for example if I select 3 out of that 24 checkboxes, I receive 27 values in the string[] cblead.
Example with 24 checkboxes:
And this is what I get in the method:
So I receive the value checked and an added false after. Any tips?
Aucun commentaire:
Enregistrer un commentaire