Wednesday, 21 August 2013

Send checkboxes values from a view to a controller in two steps?

Send checkboxes values from a view to a controller in two steps?

Let's say I've a two vanilla* html checkboxes in a Razor cshtml view.
<input type="checkbox" name="tags[]" id="categorieOne" value="1">
<input type="checkbox" name="tags[]" id="categorieTwo" value="2">
The first step would be to send this tags[] array to a controller.
The second step would be to get values 1 & 2 in seperated variables
(example: in order to show "You've selected the following categories 1 ...
2" )
*By vanilla I mean they are not written with razor.

No comments:

Post a Comment