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

后端 未结 30 3004
一个人的身影
一个人的身影 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:33

    I don't have enough rep to comment in the correct place, but I spent all day on this so want to share.

    While trying to implement the "MultipleButtonAttribute" solution ValueProvider.GetValue(keyValue) would incorrectly come back null.

    It turned out I was referencing System.Web.MVC version 3.0 when it should have been 4.0 (other assemblies are 4.0). I don't know why my project didn't upgrade correctly and I had no other obvious problems.

    So if your ActionNameSelectorAttribute is not working... check that.

提交回复
热议问题