Reputation: 39
Can I write this code for calling an MVC Controller and Action method?
<input type="button" value="Next" onclick="location.href='<%: Url.Action("Create", "StudentInfo") %> '"/>
Upvotes: 1
Views: 222
Reputation: 2552
While using the onclick handler may work, it relies unnecessarily on JavaScript. You may find using a form submission to be cleaner:
<form action="<%: Url.Action("Create", "StudentInfo") %>" method="get">
<input type="submit" value="Next" />
</form>
Upvotes: 1