In ASP.NET MVC I'm using the HTML helper
Html.BeginForm("ActionName", "Controller", FormMethod.Post);
But I need to post to: /controller/action/23434
How do I pass in the ID?
In ASP.NET MVC I'm using the HTML helper
Html.BeginForm("ActionName", "Controller", FormMethod.Post);
But I need to post to: /controller/action/23434
How do I pass in the ID?
Matt's should work fine. If you are still passing in FormMethod.Post, though, you need to do it like this:
Html.BeginForm("action","controller", new { Id = 12345 }, FormMethod.Post);
Reversing the third and fourth parameters will result in the Id being treated as an attribute instead of a route value.
<!-- ACTION: Category/Update/Id | Method:Post-->
@using (Html.BeginForm("Update", "Category",new {Id = @Model.Id },FormMethod.Post)){}