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

前端 未结 10 804
情话喂你
情话喂你 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:32

    It depends on what you mean by button. If it is a link:

    <%= Html.ActionLink("some text", "actionName", "controllerName") %>
    

    For posting you could use a form:

    <% using(Html.BeginForm("actionName", "controllerName")) { %>
        
    <% } %>
    

    And finally if you have a button:

    ';" />
    

提交回复
热议问题