1
votes

I have a Kendo MVC grid.and i need to change the default validation message of the time picker.

When i put the wrong time like 08:67 then it shows the error message "The News Date Must be a Date" and i need to change thatone to "Please Enter Correct Time"

Time Picker

 columns.Bound(p => p.NewsTime).Title("News Time").Format("{0:HH:mm}").Width(60);

I've already tried it using Data Annotation to do.

[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm}")]
public DateTime NewsDate{ get; set; }

How can i change that ?

2

2 Answers

0
votes

Try to use TimeSpan datatype instead of DateTime

[DataType(DataType.Time)]
[DisplayFormat(DataFormatString = @"{0:hh\:mm}")]
public TimeSpan Monday { get; set; }
0
votes

Try this:

[DataType(DataType.Time)]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm}")]

[Required(ErrorMessage = "Please Enter Correct Time")]

public DateTime NewsDate{ get; set; }