How do I redirect a user when a button is clicked?

前端 未结 10 802
情话喂你
情话喂你 2020-12-13 05:30

I have a view with a button. When the user clicks the button I want them redirected to a data entry view. How do I accomplish this? I should mention the views are created, t

10条回答
  •  既然无缘
    2020-12-13 06:13

    RIGHT ANSWER HERE: Answers above are correct (for some of them) but let's make this simple -- with one tag.

    I prefer to use input tags, but you can use a button tag

    Here's what your solution should look like using HTML:

    < input type="button" class="btn btn-info" onclick='window.location.href = "@Url.Action("Index", "ReviewPendingApprovals", routeValues: null)"'/> // can omit or modify routeValues to your liking
    

提交回复
热议问题