如何拨打"注册" 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>
答案 0 :(得分:18)
<input type="button" class="btn btn-info" value="Let's Go!" onclick="location.href='@Url.Action("Action", "Controller")'" />
这应该可以正常工作......
答案 1 :(得分:2)
@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { @class = "btn btn-primary", @role="button" })