I currently have the following grid on my page:

<tr ng-repeat="cartItem in vm.shoppingCart">
<td>{{cartItem.Title}}</td>
<td>
    @using (Html.BeginForm("Delete", "MyController", FormMethod.Post))
    {
        @Html.AntiForgeryToken()
        <input type="submit" value="Delete" id="DeleteBtn" name="DeleteBtn" class="btn blue" />
    }
</td>

Our users have requested that the delete happen with a post to the server, so we setup a form in the grid, i'm not sure if that's the best way to go about it. also how would we pass in the Id (cartItem.Id) of the item to delete to the action? Is it common to have a form in each row like this? otherwise we can convince the users to do it through client side.

share|improve this question
2  
If you are using Ng-repeat, and not using the MVC model for the page, it would be easier to just do a http post through angular i think than doing it through MVC Action links. If you used @foreach (var cartItem in Model){} you could do a MVC HtmlAction Link to a post pretty easily. – Dylan Jun 9 at 14:59
    
@Dylan yes that is what we were thinking as well, rather than mixing them together. – Paritosh Jun 9 at 16:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.