Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,

In MVC form datetimepicker is there, validation done using mvc validation, but not working in Internet explorer. If i pick and select correct date and time also showing invalid date and time error. Selection value is : 25/December/2015 09:45 pm


Code for Reference:

HTML
<div class="form-group">
                            @Html.LabelFor(m => m.DateTimeArrival, new { @class = "col-md-2 control-label" })
                            <div class="col-md-3">
                                <div class='input-group date' id='DateTimeArrID' data-date-format="dd/MM/yyyy HH:ii p">
                                    @Html.TextBoxFor(m => m.DateTimeArrival, "{0:dd/MM/yyyy hh:mm tt}", new { @class = "form-control"})
                                    <span class="input-group-addon">
                                        <span class="fa fa-calendar"></span>
                                    </span>
                                </div>
                                @Html.ValidationMessageFor(m => m.DateTimeArrival, "", new { @class = "text-danger" })
                            </div>




C#
[DisplayName("Date and Time of Incident")]
        [Required]
        [DataType(DataType.DateTime), DisplayFormat(DataFormatString = "{0:dd/MM/yyyy hh:mm tt}", ApplyFormatInEditMode = true)]
        public Nullable<System.DateTime> DateTimeArrival{ get; set; }




Thanks,
Suresh
Posted
Comments
Bryian Tan 6-Jan-16 0:02am    
I think MMM will return the month name (December), MM will return 12 ?
itsureshuk 6-Jan-16 1:17am    
In Chrome and Firefox its working... Only in IE its not working...
[no name] 6-Jan-16 6:05am    
Which version of IE, are you using?

Secondly make sure that Javascript is enabled in IE browser.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900