Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

@Html.ActionLink calling Post method

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?

like image 486
Sachin Kainth Avatar asked Oct 24 '25 06:10

Sachin Kainth


2 Answers

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" />
like image 99
Liz Nett Avatar answered Oct 27 '25 00:10

Liz Nett


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.

like image 42
jwaliszko Avatar answered Oct 26 '25 23:10

jwaliszko