Asp.net mvc 4 MVC 4-单击按钮将参数传递给控制器

Asp.net mvc 4 MVC 4-单击按钮将参数传递给控制器,asp.net-mvc-4,Asp.net Mvc 4,我有一个MVC4项目,它有一个保存按钮,单击该按钮时要求用户确认,然后将整个表单提交给控制器,并将模型作为输入,而不是formCollection。现在我需要在表单中添加另一个名为Submit的按钮。如何传递参数来区分保存和提交?我想继续使用JQuery函数进行确认。以下是一些代码片段: JavaScript function SavePlan() { if (ValidateAmounts() != true) { var message = "Do you want to

我有一个MVC4项目,它有一个保存按钮,单击该按钮时要求用户确认,然后将整个表单提交给控制器,并将模型作为输入,而不是formCollection。现在我需要在表单中添加另一个名为Submit的按钮。如何传递参数来区分保存和提交?我想继续使用JQuery函数进行确认。以下是一些代码片段:

JavaScript

function SavePlan() {
    if (ValidateAmounts() != true) {
    var message = "Do you want to save? ";
    CreateConfirmationMessage(message, '$("#form_FiscalYearPlanning").submit();');
    return;
}

}
JQUERY

function CreateConfirmationMessage(message, confirmActionToTake, cancelActionToTake) {

    $('#PROJECT_confirmationQuestion').html(message);

            if (confirmActionToTake !== null) {
        $('#button_confirmationAccept').attr('onClick', confirmActionToTake);
    }
            else {
        $('#button_confirmationAccept').removeAttr('onClick');
    }

            if (cancelActionToTake !== null) {
        $('#button_confirmationCancel').attr('onClick', cancelActionToTake);
    }
            else {
        $('#button_confirmationCancel').removeAttr('onClick');
    }
    $('#modal_confirmation').modal('show');
}/
看法

:::


输入按钮有一个值。您可以在控制器上检测输入按钮的值

<input type="submit" value="submitbutton">
<input type="submit" value="savebutton">


我运行了一个快速测试,按钮的定义如下:Save…我的控制器的定义如下:public ActionResult FiscalYearPlanning(VM\u FiscalYearPlanning model,string button\u SavePlan),但controllerMy bad中的按钮值为null。我把按钮移到了表单外面,因为代码直接进入控制器并自动开始保存表单,而不用等待确认问题的响应。有没有办法解决这个问题?
<button class="btn btn-primary PROJECT_formButtonPopover" id="button_SavePlan" name="button_SavePlan" onClick="SavePlan();" data-toggle="popover" data-content="Save your plan, but do not submit it for review.">Save</button>
public ActionResult FiscalYearPlanning(VM_FiscalYearPlanning model)
<input type="submit" value="submitbutton">
<input type="submit" value="savebutton">