I have this code
Razor
@foreach (SFD.Models.General.List.Customer item in Model.CustomerList)
{
<tr id="@item.CustomerId">
<td>@Html.CheckBox("CustomerId["+@item.CustomerId+"]")</td>
...
</tr>
}
which generate html output
<input name="CustomerId[22394]" id="CustomerId_22394_" type="checkbox" value="true">
<input name="CustomerId[22394]" type="hidden" value="false">
the problem I need to solve is that checkbox group is outside form
@using (Html.BeginForm("Index", "Customer", FormMethod.Post }))
{
...
}
and therefore checkbox group values are not send after submit value. So my question is, how I can add these values to the submit request ? Maybe with jQuery onclick event ? What datatype property for checkbox group is suitable, it is for example an array ?
public int[] CustomerId;
Aucun commentaire:
Enregistrer un commentaire