Übergeben Sie die Werte von checkBox an die Controller-Aktion in asp.net mvc4
Ich möchte testen, ob das Kontrollkästchen von meinem Acion Methon aktiviert ist oder nicht. Ich muss den Kontrollkästchenwert von der Ansicht an den Controller übergeben
Das ist meine Ansicht
@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>
und ich versuche das:
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);
}
, aber ich habe diesen Fehler:
Der Parameter wird als Nullwert für den Parameter "checkAct" des Typs "non Nullable" angegeben .Controller.GrapheController ». Un paramètre facultatif doit être un type référence, un type Nullable. Nom du paramètre: parameter
Kannst du mir bitte helfen !