How do you handle multiple submit buttons in ASP.NET MVC Framework?

后端 未结 30 3523
一个人的身影
一个人的身影 2020-11-21 07:16

Is there some easy way to handle multiple submit buttons from the same form? For example:

<% Html.BeginForm(\"MyAction\", \"MyController\", FormMethod.Pos         


        
30条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-21 07:52

    You could write:

    <% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %>
    
    
    <% Html.EndForm(); %>
    

    And then in the page check if the name == "Send" or name == "Cancel"...

提交回复
热议问题