是否有可能重写编辑模板?
我在我的模型,用于到达/离开日期日期时间字段 - 这些是使用以下EditorTemplate呈现:
@model Nullable<System.DateTime>
@if ( Model.HasValue ) {
@Html.TextBox( "" , String.Format( "{0:dd/MM/yyyy}" , Model.Value ) , new { @class = "datepicker span2" } )
}
else {
@Html.TextBox( "" , String.Format( "{0:dd/MM/yyyy}" , DateTime.Now ) , new { @class = "datepicker span2" } )
}
...这将格式化日期时间字段,例如:01/08/2012
不过,我也想展示,在另一个领域,日期和时间的预订是由例如:
22/07/2012 08:23
我的模型是:
public DateTime Arrival { get; set; }
public DateTime Departure { get; set; }
public DateTime TimeBooked { get; set; }
我想TimeBooked显示时间,以及 - 但编辑模板显然只是显示的日期。
这能覆盖? 或者有没有这样做的另一种方式?
谢谢,
标记