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

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

    [HttpPost]
    public ActionResult ConfirmMobile(string nameValueResend, string nameValueSubmit, RegisterModel model)
        {
            var button = nameValueResend ?? nameValueSubmit;
            if (button == "Resend")
            {
    
            }
            else
            {
    
            }
        }
    
    
        Razor file Content:
        @using (Html.BeginForm()
        {
            

    Confirm Mobile Number

    @Html.EditorFor(model => model.VefificationCode) @Html.LabelFor(model => model.VefificationCode, new { }) @Html.ValidationMessageFor(model => model.VefificationCode)
    }

提交回复
热议问题