Requiring Date and Time
I need a datetime. I currently have:
Model:
[DisplayFormat(DataFormatString = "{0:f}", ApplyFormatInEditMode = true)]
public DateTime DateFrom { get; set; }
Controller:
assetBookingModel.DateFrom = DateTime.Now.AddDays(1);
View:
@Html.EditorFor(model => model.DateFrom)
This displays a text box with a date and no time. I can add a calendar
extender with a time property without too much problems, but MVC doesn't
seem to have any proper validation for this, or add in the time by
default.
I have searched the web and there isn't too much help to be found.
What is the best way to go about implementing a Date and Time field, that
will not accept only the Date.
No comments:
Post a Comment