ASP.NET MVC Ajax.BeginForm eats params of submit button clicked. Looks like bug

后端 未结 5 1542
粉色の甜心
粉色の甜心 2021-02-11 04:33

If you are using Ajax.BeginForm() with multiple submit buttons similar to this:

// View.aspx
<% using (Ajax.BeginForm(\"Action\", \"Controller\", 
                    


        
5条回答
  •  别跟我提以往
    2021-02-11 05:04

    I did the following:

                
                     
                
                
    

    i.e. defined a hidden input type with id of "btnSubmit" and on each button added the onclick event as onclick="$('#btnSubmit').attr('value','Delete');". this seems to work as I was able to get the value of the button clicked in the controller:

    public ActionResult SaveCreateBlot(string btnSubmit) {

    }

提交回复
热议问题