Pase los valores de checkBox a la acción del controlador en asp.net mvc4
Quiero comprobar si la casilla de verificación está marcada o no en mi metano de ación, lo que necesito es pasar el valor de la casilla de verificación de la vista al controlador
esta es mi opinión
@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>
y lo intento:
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);
}
, pero tengo este error:
Nict pour le paramètre «checkAct» de type Non Nullable «System.Boolean» pour la méthode «System.Web.Mvc.ActionResult Index (System.String, System.String, Boolean)» dans «Project .Controllers.GrapheController ». Un paramètre facultatif doit être un type référence, un Type Nullable ou être déclaré en tant que paramètre facultatif. Nom du paramètre: parámetros
Puedes ayudarme por favor !