Call Html.ActionLink with a button?

How can I call the "Register" ActionLink (the one generated on a standard MVC5 project using VS2013) using the boot button?

This is the source code:

@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" }) 

I tried this, but obviously this did not work:

 <button type="button" class="btn btn-info" onclick="window.location.href('@Url.Action("Register", "Account")')">Add New User</button> 
+5
source share
1 answer
 <input type="button" class="btn btn-info" value="Let Go!" onclick="location.href='@Url.Action("Action", "Controller")'" /> 

This should work fine ...

+12
source

Source: https://habr.com/ru/post/1233929/


All Articles