1

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") %> '"/>
1
  • This question could be improved by including more of the code surrounding the line in question. It would be helpful to know whether or not this tag is within a form. Commented Nov 17, 2019 at 17:10

1 Answer 1

1

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>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.