In my Model I have the following :
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:H:mm}")]
public DateTime _time { get; set; }
In my Edit View in the Textbox the value that is set is the full Date and time and when ever i try manually to edit the value through the browser the jQuery Validations Yields an error that the date format is not correct
while I’m adding ApplyFormatInEditMode=true why in the textbox I’m getting the Full Date the the formated one (only time) and why the jQuery validator throw error when the format is time only without date and how can I by pass it?
You should use
Html.EditorForand notHtml.TextBoxForif you want the custom format to be applied:Also by naming a property
_timeyou are violating at least 2 C# naming conventions (property names start with an uppercase letter and not with an underscore).