I have an MVC3 C#.NET web app and need to call a view using Html.ActionLink. I can't tell from the documentation if I can specify the POST or GET. Below is my HTML, is there a way to specify GET or POST?
@Html.ActionLink("Create New", "Edit", "Subtask",
new {Id = ViewBag.Id, Command="CreateHourEntry"}, null)
If you want a post use Ajax.ActionLink but be aware it's an Ajax post. You could easily use jquery to cause your existing link to cause a form post but this functionality is not included in Html.ActionLink.
See ASP.NET MVC ActionLink and post method
HTML hyperlinks send GETs.
To POST, you need to use a form.
or some Javascript
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With