我想在表中插入一个固定的日期。我怎样才能做到这一点 ?如何在MVC中的表中插入固定值
<div class="editor-label">
Description :
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Description, new { @class = "textboxes" })
@Html.ValidationMessageFor(model => model.Description)
</div>
<div class="editor-label">
Date :
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.Date, new { @class = "textboxes" }) /// I wanna be here a fixed date .
@Html.ValidationMessageFor(model => model.Date)
</div>
我的控制器代码是:
public ActionResult Index(tblOrder tblorder)
{
if (ModelState.IsValid)
{
db.tblOrders.AddObject(tblorder);
db.SaveChanges();
return RedirectToAction("Index");
}
ViewBag.fxBudjet = new SelectList(db.tblBudjets, "ID", "Budjet", tblorder.fxBudjet);
ViewBag.fxServiceType = new SelectList(db.tblServiceTypes, "ID", "Service", tblorder.fxServiceType);
ViewBag.fxStartTime = new SelectList(db.tblStartDates, "ID", "StartDate", tblorder.fxStartTime);
return View(tblorder);
}
我需要改变我的控制器代码?
可能重复的一些想法。网络MVC](http://stackoverflow.com/questions/10265925/inserting-static-date-or-text-int-database-by-asp-net-mvc) – nemesv 2012-04-22 11:05:37
不完全确定你的意思,但如果你的意思你想只显示我的答案应该工作的价值 – Manatherin 2012-04-22 11:06:43
不,我想通过我的owow插入一个日期n代码,而不是用户..我不想显示任何日期。只是我想用自己的代码注册一个数据库的日期。 – 2012-04-22 11:10:13