-1
我想設置值到ViewBag,像波紋管如何使用ViewBag值設置模型屬性?
public ActionResult Register(Guid accountId)
{
ViewBag.AccountId = accountId;
return View("Register", "Account");
}
現在內註冊查看,我可以設置,如波紋管
@Html.HiddenFor(m => m.AccountId, new { id = "hdaccountid", value = ViewBag.AccountId })
我想更新與ViewBag價值模型屬性。所以當我想在控制器內更新模型時,所以model屬性包含適當的值。
我不想使用ModelView。請建議。
如果我已經'MoveToRegister(GUID帳戶ID)'設置ACCOUNTID爲u描述爲隱藏,則另一個'寄存器(的usermodel模型)的圖內'從這個更新數據庫? –
如果你想從視圖中獲取模型,你應該傳遞模型來查看。 –
@AliRızaAdıyahşi:如果我想,隱藏在控制器中的價值,那麼我怎麼能得到。其實我有兩個ActionResult - >從它通過accountid到一個視圖。然後輸入一些值 - >提交表單 - >調用另一個操作結果並將數據保存到數據庫中,包括隱藏的字段值。 –