【发布时间】:2016-01-16 07:38:45
【问题描述】:
如何调用“注册”ActionLink(在标准 MVC5 上生成的 使用 VS2013 的项目)从引导按钮?
这是原始代码:
@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })
我试过了,但显然没有用:
<button type="button" class="btn btn-info" onclick="window.location.href('@Url.Action("Register", "Account")')">Add New User</button>
【问题讨论】:
-
为什么你不使用正确类的锚? @Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink", @class="btn btn-info btn-link" }) 应该可以工作并且应该是也可以作为按钮可见。
-
完美。它工作得很好。我投了赞成票。
标签: html asp.net-mvc twitter-bootstrap