This is an Asp.net MVC application. I have installed packages jQuery.alidation.Globalize and jQuery.UI.i18n and have set fixed culture "es-PY" in web.config
<globalization enableClientBasedCulture="true" uiCulture="es" culture="es-PY" />
I have set this culture also for jQuery validations:
$(document).ready(function () {
Globalize.culture('es-PY');
$.datepicker.setDefaults($.datepicker.regional["es"]);
$("input[type='date']").datepicker();
});
Also i have decorated Dates properties as follow in my model:
[DataType(DataType.Date), DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}", ApplyFormatInEditMode = true)]
public System.DateTime Fecha { get; set; }
I'm facing problems with displaying the jQuery datepicker, as you can see from the image i get not one, but two dropdown calendars, apart from that in the text input the value is seted to dd/mm/aaaa, it should be rendered with the Fecha property. When i try to select a date from the calendar the client validation fails which is disconcerting me because es-PY culture accept dd/MM/yyyy date format.
So my question actually are two in one: Why i am getting two calendars for the inputbox and what else should i do to get the date pass validation in client browser?
EditorFor
? If you have an email control template, it will use that as the editor, and then you applied another using the datepicker plugin. – Tieson T. Jun 13 at 22:14EditorFor
toTextBoxFor
- otherwise the Razor engine will create a<input type="date" />
element, and then it's up to the browser to decide what to do. – Tieson T. Jun 13 at 22:37DateTime
property triggers the Razor engine to use Telerik's Date.cshtml template when usingEditorFor
. – Tieson T. Jun 13 at 22:41