2013-06-03 27 views
1

我查看网页代码:如何在查看页面呈现后保留0值?

Html.LabelFor(x => x.StartTime, new {@class = ""}), Html.TextBoxFor(x => x.StartTime, new 
            { 
             @class = "startTime form-time", @Value = Model.StartTime.HasValue 
                             ? new DateTime(Model.StartTime.Value.Ticks).ToString("h:mm tt") 
                             : string.Empty 
            }) 

我在TimePicker在开始时间字段使用jQuery slected 08:00 AM。但是在从下拉字段中选择一个值(进入服务器端)之后,在查看页面呈现后,时间选择器字段值更改为8:00 AM。也就是说,它删除了值。但我希望价值如同08:00 AM

回答

1

更多信息,它没有“删除”的价值 - 它是从来没有 - 这就像需要使用hh:mm tt而不是h:mm tt

+0

按预期正常工作。谢谢。 –

0

您需要在您的timepicker配置来定义这个喜欢

$('#timepicker').timepicker({ 
    showPeriod: true, 
    showLeadingZero: true 
}); 

你可以找到弗朗索瓦Gelinas页面上TimePicker

+0

我包含'showLeadingZero:true',但即使'0'值已被删除。 –