Passar valores de checkBox para ação do controlador em asp.net mvc4
Eu quero testar se a caixa de seleção está marcada ou não do meu acion methon, o que eu preciso é passar o valor da caixa de verificação da vista para o controlador
esta é a minha opinião
@using (Html.BeginForm("Index", "Graphe"))
{
<table style="width: 100%;" border="1">
<tbody>
<tr>
<td>Responsable:</td>
<td><select id="Responsables" name="responsables" ><option>Selectionnez --</option></select></td>
<td><input id="responsable" name="checkResp" type="checkbox" /> </td>
</tr>
<tr> <td><input type="submit" value="Afficher" id="ButtonSubmit"/></td>
<td><input class="button" id="ButtonReset" type="button" value="Annuler" /></td>
</tr>
</tbody>
e eu tento isso:
public ActionResult Index( string responsables, bool checkResp)
{
Highcharts chart = new Highcharts("chart");
if (responsables != null)
{
if (checkResp)
chart = Global();
else
chart = Resp(responsables);
}
else
chart = Global();
return View(chart);
}
, mas eu tenho esse erro:
Le dicionnaire de paramètres contient une entée Null pour le paramètre «checkAct» de tipo não anulável «System.Boolean» pour la méthode «System.Web.Mvc.ActionResult Index (System.String, System.String, Boolean)» dans «Project .Controllers.GrapheController ». Un paramètre facultat doitre untre reférence, un type Nullable ou être déclaré en tant que paramètre facultatif. Nom du paramètre: parameters
Você pode me ajudar por favor !