4

I have a @HTML.ActionLink in my Razor view and I'd like for it to call a Post action method rather than a Get one.

Is this possible?

dnlcrl
  • 5,022
  • 3
  • 32
  • 40
Sachin Kainth
  • 45,256
  • 81
  • 201
  • 304
  • Possible duplicate of [ASP.NET MVC ActionLink and post method](https://stackoverflow.com/questions/2048778/asp-net-mvc-actionlink-and-post-method) – GSerg Sep 23 '18 at 09:04

3 Answers3

5

If you are using bootstrap you can easily make a button look like a link by applying the btn-link class, for example

<input type="submit" name="ActionType" value="Edit" class="col-md-1 btn btn-link" />
Liz Nett
  • 139
  • 2
  • 7
4

If you want to invoke POST action, put this link inside form which uses POST action, or use ajax version. You can find some more details here.

Community
  • 1
  • 1
jwaliszko
  • 16,942
  • 22
  • 92
  • 158
1

Yes and no. Normal ActionLinks will be normal links. Either you have to use a form (with method being post of coorse) and have a link sumbit it. Or you could add in a but of javascript and a nice extension.

Have a look at http://dr2ab.wordpress.com/2011/07/25/linkbuttons-in-mvc-razor/

Might be something for you.

René Wolferink
  • 3,558
  • 2
  • 29
  • 43