1
我創造某種形式,我需要分配領域CreationDate
上提交表單:ASP.NET MVC 4:如何從視圖上更新模型提交表單
@model Namespaces.Chapter
@using (Html.BeginForm()) {
<p>Title: @Html.TextBoxFor(c => c.Title)</p>
...
@{ Model.CreationDate = DateTime.Now;} <- somehow like that, but this code does not works
<input type="submit" value="Submit" />
}
如何做到這一點?
,則應該設置在你的控制器創建日期。如果你設定的是客戶端,你相信你的客戶的時鐘是準確的。 –