Reputation: 2589
How can I call the "Register" ActionLink (The one generated on the standard MVC5 project using VS2013) from a bootstrap button?
This is the original code:
@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })
I tried this but obviously it didn't work:
<button type="button" class="btn btn-info" onclick="window.location.href('@Url.Action("Register", "Account")')">Add New User</button>
Upvotes: 15
Views: 45070
Reputation: 61
@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { @class = "btn btn-primary", @role="button" })
Upvotes: 6
Reputation: 3067
<input type="button" class="btn btn-info" value="Let's Go!" onclick="location.href='@Url.Action("Action", "Controller")'" />
This should work fine...
Upvotes: 26