0

I have a jQuery datetime picker.

This is the property of the model:

[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
[DisplayName("Birth date (DD/MM/YYYY)")]
public DateTime? BirthDate { get; set; }

The code in the view:

@Html.TextBoxFor(m => m.Employee.BirthDate, new { @class = "dpTextBox" })

some javascript:

$(".dpTextBox").datepicker({
                changeMonth: true,
                changeYear: true,
                dateFormat: 'dd/mm/yy'
            });
$.datepicker.setDefaults($.datepicker.regional['nl']);

In Internet Explorer, it works fine. In Chrome it doesn't. The validation error is "The field Birth date (DD/MM/YYYY) must be a date." The language of Chrome is English. When I change the language to Dutch, it works fine, but I want the UI of Chrome in English...

2 Answers 2

1
@{Html.Telerik().DatePickerFor(model => model.BlogDate)
                    .Name("BlogDate")
                    .HtmlAttributes(new { id = "DatePicker_wrapper" })
                    .OpenOnFocus(true)
                    .Render();              
            }

use Telerik datepicker

Sign up to request clarification or add additional context in comments.

2 Comments

Why do you propose to use 3rd party library only for datepicker?
I'd consider down voting this due to the lack of response to the question. At a minimum this ought to be clarified to be a CLEARLY defined alternative to the original posters question.
0

When I delete the following piece of code, it works fine...

@Scripts.Render("~/bundles/jqueryval")

It has something to do with this library

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.