asp.net-mvc @Html.ActionLink 调用 Post 方法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13161645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
@Html.ActionLink calling Post method
提问by Sachin Kainth
I have a @HTML.ActionLinkin my Razor view and I'd like for it to call a Postaction method rather than a Getone.
@HTML.ActionLink我的 Razor 视图中有一个,我希望它调用一个Post操作方法而不是一个操作方法Get。
Is this possible?
这可能吗?
采纳答案by jwaliszko
回答by Liz Nett
If you are using bootstrap you can easily make a button look like a link by applying the btn-link class, for example
例如,如果您使用的是引导程序,则可以通过应用 btn-link 类轻松地使按钮看起来像链接
<input type="submit" name="ActionType" value="Edit" class="col-md-1 btn btn-link" />
回答by René Wolferink
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.
是和否。普通 ActionLink 将是普通链接。要么你必须使用一个表单(方法是 post of coorse)并有一个链接 sumbit 它。或者你可以添加一个 javascript 和一个不错的扩展。
Have a look at http://dr2ab.wordpress.com/2011/07/25/linkbuttons-in-mvc-razor/
看看http://dr2ab.wordpress.com/2011/07/25/linkbuttons-in-mvc-razor/
Might be something for you.
可能适合你。

