Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67441

Submit multiple values with @Html.CheckBox

$
0
0

I am attempting to POST multipile values to the Controller when using @Html.BeginForm inside foreach but anything beside first selected checkbox is ignored.

enter image description here

When I check the browser devtools I can see that only thing posted is the first selected value despite mutiple selection

I have tried to pass values in both @Html.BeginForm and @Html.CheckBox and only the first one worked for the single value

<td>

 @using (Html.BeginForm("AddDismissRule", "Home", new { Rule = item.HashDetails, RuleType = 5, Url = this.Request.RawUrl, Name = item.Message }))
{
    @Html.CheckBox("checkResp", new { @class = "checkbox-trash" })

   <input onclick=" toast(2, '@item.Message','Dismissing...')" id="submit-checkbox" type="submit" value="Submit" />
}

 </td>

Maybe there is a simplier way to handle this?


Viewing all articles
Browse latest Browse all 67441

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>