I have a field on my view (a checkbox) that has the value of an id from the model. I need to return a list of those ids that the user checked on the form to the controler action.
Every thing I have tried doesn't work. I have the view coded to return to the controller but I haven't figured out how to return the values needed.
This is a snippet of the checkbox in the view...
<td @trFormat >
<input id="ExportCheck" type="checkbox" value = "@item.PernrId" onclick="saveid(value);"/>
</td>
currently the onclick event is firing a javascript on the view that should be storing the id values...
<script type="text/javascript">
var keys = null;
function saveid(id) {
keys += id;
}
</script>
I have been trying to use an action call to get back to the controller. Currently there is no routing object being sent back because I can't figure out how to load it...
<input type="submit" value="Export to Excel" onclick="location.href='@Url.Action("ExportExcel","CastIndex")'" />
I know I am probably doing many things wrong with this code. I am just now working on my first MVC application. Any help would be appreciated. Ultimate outcome is that I need to have the ids in the controller to retrieve the selected ids and send them to an export to excel.