这在我的模型中是什么:
public CheckBoxListItem Same { get; set; }
[Required(ErrorMessage = "* Billing Name field is required")]
public string BillingName { get; set; }
这就是我认为:
@Html.LabelFor(model => model.Same.IsChecked, "Billing Is Same As Shipping")
@Html.HiddenFor(model => model.Same.Text)
@Html.CheckBoxFor(model => model.Same.IsChecked)
</div>
<h3>Billing Information</h3>
<div>
@Html.LabelFor(model => model.BillingName, "Name")
@Html.EditorFor(model => model.BillingName)
@Html.ValidationMessageFor(model => model.BillingName)
</div>
选中该复选框后,我希望在提交表单时不再需要BillingName所需的验证。我如何在MVC中执行此操作?