How do I handle postback for radio buttons in ASP MVC 5? This tells how to do it for text inputs, but not radio buttons. With radio buttons, all radio buttons have the same names, so the model doesn't apply. Do I need a for loop of if statements, or is there a simple way?
For some example code:
<ul class="dropdown-menu report-checkbox-dropdown" role="menu" aria-labelledby="menu1">
<li><input type="radio" name="quantity" value="all_quantities" data-stoppropagation='true' />All items</li>
<li><input type="radio" name="quantity" value="in_stock" data-stoppropagation='true' />In Stock</li>
<li><input type="radio" name="quantity" value="out_of_stock" data-stoppropagation='true' />Out of Stock</li>
</ul>
While I'm at it, I'll ask about how to do it with checkboxes -- probably the same.
Edit
I tried sticking in @Request.Form.AllKeys
just to see what it would return, but all I got was System.String[]
.