我正在尝试在表单上设置单选按钮,并通过表单提交操作提交。问题是,调试模型属性SendEmail时没有设置。 下面是我正在使用的代码,我无法弄清楚(由于缺乏前端调试经验)。如果有人有任何指示或任何有用的建议。 只是为了让您了解代码。我有3个单选按钮,我与模型属性SendEmail绑定。我通过在Yes Button上调用javascript函数提交表单,该按钮本身提交表单。现在,当我在Model类中使用断点来查看属性是否已设置时,我看到null。
<script>
$('#ExchangeChangeConfirmationDiv').on("click", "#BtnSubmit", function () {
showLoadingImage();
if ($("#ProcessConsumerExchangeChange").valid()) {
$("#ProcessConsumerExchangeChange").submit();
HideConfirmationModal();
}
else {
hideLoadingImage();
return false;
}
});
<div id="ExchangeChangeConfirmationDiv" class="modal modal-sm">
<div class="modal-dialog">
<div class="modal-content">
<div id="inline_content">
<div class="modal-header">
<h2>Process Change</h2>
<div class="modal-close" data-dismiss="modal">close</div>
</div>
<div class="modal-body">
<input type="hidden" id="DeleteID" />
<div>
Are you sure you wish to process this exchange change request?
<br /><br />
This action cannot be undone without sizable administrative effort.
<br /><br />
Please save a copy of the employee's existing coverages before performing this step.
</div>
<div class="modal-footer">
<br />
Do you want to notify customer?
<br />
@Html.RadioButtonFor(model => model.SendEmail, "E-Mail")
@Html.RadioButtonFor(model => model.SendEmail, "PDF")
@Html.RadioButtonFor(model => model.SendEmail, "Cancel")
</div>
<div class="centeredButtons">
<div class="clearfix">
<a href="javascript:void(0);" class="button blue" data-dismiss="modal">No</a>
<a id="BtnSubmit" href="javascript:void(0);" class="button green">Yes</a>
</div>
</div>
</div>
</div>
</div>
</div>
Model Class:
public string SendEmail { get; set; }