與佈線向上日期選擇器日期選擇器不保存到數據庫
爲局部視圖的代碼
@model System.DateTime
@Html.TextBox("", Model.ToString("dd/MM/yy"), new { @class = "date" })
爲視圖的代碼
@Html.TextBox("DateTime", (Model.AdvertStartDate.ToString()), new { @class = "date" })
腳本
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
問題用於datepick的代碼呃
<script type="text/javascript">
$(document).ready(function() {
$('.date').datepicker
({
dateFormat: 'dd/mm/yy',
showStatus: true,
showWeeks: true,
currentText: 'Now',
autoSize: true,
gotoCurrent: true,
showAnim: 'blind',
highlightWeek: true
});
});
</script>
代碼模型
[Required]
public DateTime AdvertStartDate { get; set; }
的日期插入文本框,但在數據庫中
您能否提供任何缺失沒有更新?
嘗試選擇此日期「1/1/2012」一邊保存,這是否也行不通,我想我知道這個問題,但你先試試這個,讓我知道 – Yasser 2012-04-09 10:31:21
仍然不起作用! – 2012-04-09 10:36:09
嗯,好的,你如何保存日期填滿? – Yasser 2012-04-09 10:40:28