1
其實我對ASP.NET MVC很陌生,我需要你的幫助。在ASP MVC視圖中分配變量3
在這裏我有一些製作方法,它有一個參數從URL中使用它作爲ID:
public ActionResult Create(int id)
{
Meeting meeting = db.Meetings.Find(id); // get the object
ViewBag.meetingID = meeting.meetingID; // get its id and assign it to a ViewBag
return View();
}
,我想這樣做:
在「選票」控制器vote.meetingID = @ViewBag.meetingID
在模型中,以便直接
是assgin此屬性不excplicitely從HTML視圖鍵入它(我的意思@ Html.EditorFor(型號=> meetingID))
視圖模型有什麼問題? http://blog.gauffin.org/2011/07/three-reasons-to-why-you-should-use-view-models/ – jgauffin 2012-03-14 12:26:35