I want to be able to pass the id value of a button using an onclick (location.href) from my view to a controller action result. My code is as follows:
<a class="btn btn-danger btn-ok" id="sendId()" onclick="location.href = '@Url.Action("DeleteUserType","Admin", new { id = })'">Delete</a>
So i want the id value ( sendId() ) to be returned to the action result "DeleteUserType" in the "Admin" controller via the "new { id = ... })" portion of the location.href event. My view includes the following at the top:
@model List<FoodSpot.ViewModels.UserTypeViewModel>
Therefore to access specific view model attributes, id need a foreach (which wont necessarily work in the above case) are there any alternatives to this problem?