我在 MakePayment.cshmtl 视图的模型中获取数据时遇到问题。
AccountScreen.cshtml 正在调用 MakePayment.cshtml 视图:
@model SuburbanCustPortal.SuburbanService.CustomerData
@{
ViewBag.Title = "Account Screen";
}
<h2>AccountScreen</h2>
<div class="leftdiv">
<fieldset>
<legend>customer info</legend>
@Html.Partial("CustomerInfoPartialView", Model)
</fieldset>
<fieldset>
<legend>delivery address</legend>
@Html.Partial("DeliveryAddressPartialView", Model)
</fieldset>
<fieldset>
<legend>delivery info</legend>
@Html.Partial("DeliveryInfoPartialView", Model)
</fieldset>
</div>
<div class="rightdiv">
<fieldset>
<legend>balance</legend>
<div>
@Html.Partial("BalancePartialView", Model)
</div>
</fieldset>
<fieldset>
<legend>payment</legend>
<div>
@Html.Partial("MakePayment", Model)
</div>
</fieldset>
<fieldset>
<legend>billing info</legend>
<div>
@Html.Partial("BillingInfoPartialView", Model)
</div>
</fieldset>
</div>
我的 MakePayment.cshtml 视图:
@model SuburbanCustPortal.SuburbanService.CustomerData
@using (Html.BeginForm("MakePayment2", "Customer", FormMethod.Post))
{
<div style="text-align:center;">
<input class="makePaymentInput" type="submit" value="Make a Payment" />
</div>
}
我的客户控制器:
public ActionResult AccountScreen(LogOnModel model)
{
return ShowCustomer(model.AccountNumber);
}
public ActionResult MakePayment(CustomerData model)
{
return View("MakePayment", model);
}
[HttpPost]
public ActionResult MakePayment2(CustomerData model)
{
//CustomerData model = new CustomerData();
var newmodel = new PaymentModel.SendToGateway();
newmodel.AccountBalance = model.TotalBalance;
newmodel.Amount = model.TotalBalance;
return RedirectToAction("PrePayment", "Payment", newmodel);
}
public ActionResult MakePayment(CustomerData model)
永远无法达到。
我的问题:正在[HttpPost] public ActionResult MakePayment2(CustomerData model)
达到但模型中有空值。
我知道正在填充来自 AccountScreen 的数据初始模型,因为正在呈现的其他视图正在显示数据。
有人看到我做错了吗?