0
我在嘗試更新模型屬性值,但在httpost中未反映輸入的新值,顯示原始值。 感謝您的幫助。MVC6輸入asp-for not change模型屬性值
<div class="row row-padding">
<section class="form-field">
<input asp-for="bidDataProcess.MaxBidPosted" type="number" class="form-control" />
<form asp-controller="Item" asp-action="PlaceBid" asp-route-ItemId="@Model.itemDescription.ItemId" asp-route-MaxBid="@Model.bidDataProcess.MaxBidPosted" method="post" class="clearfix">
<input id="PlaceBid" type="submit" style="background-color:blue;color:white; font-weight:bold;width:50%" class="form-control text-center" value="Place Bid" />
</form>
</section>
[HttpPost]
public ActionResult PlaceBid(int ItemId, decimal MaxBid)
{
// Maxbid resturns the original value not the new value entered.
decimal maxBid = MaxBid;
return View();
}
是我不是因爲輸入標籤超出了您的表單打開和關閉標籤? – firste