由于某种原因,我的控制器中的 3 个 HttpPost 函数没有被调用。我尝试用不同的名称重新制作视图,但没有成功。它们都返回到索引视图而不是运行 HttpPost 函数。
控制器:
[HttpPost]
public ActionResult OrderIsFinished(string PickUp, string DeliveryBigger, string DeliverySmaller)
{
string view = "";
if (PickUp != null)
{
view = "OrderPickUp";
}
if (DeliveryBigger != null)
{
view = "DeliveryBigger";
}
if (DeliverySmaller != null)
{
view = "DeliverySmaller";
}
return View(view);
}
看法:
@{
ViewBag.Title = "OrderIsFinished";
}
@section shoppingcart {
<p>Shopping Cart</p>
}
<h2>OrderIsFinished</h2>
@using (Html.BeginForm())
{
<input type="submit" name="PickUp" value="Ik kom mijn bestelling afhalen" />
<input type="submit" name="DeliveryBigger" value="Ik wil dat u mijn bestelling levert" />
<input type="submit" name="DeliverySmaller" value="Ik wil dat u mijn bestelling levert" />
}
当我在函数上放置断点时,我不在那里,它只返回索引视图。