I am developing asp.net mvc3 project on windows 7, vs 2010. I have added jquery and jquery ui references to project.
I have a form that saves data to database. In my form I have a textbox which binded editor template for show date picker.
If I publish the project on my computer (windows 7 IIS 7) everything works correctly. But When I upload the published project to server (Windows 2003 IIS 6) the date picker value is not correct error occuring.
Editor Template
@model Nullable<System.DateTime>
@Html.TextBox( "",
Model.HasValue ? Model.Value.ToString("dd.MM.yyyy") :string.Empty,
new { data_datepicker = true, @class = "text-box " })
Javascript code for format datepicker
$(document).ready(function () {
$.datepicker.setDefaults($.datepicker.regional['tr']);
$.datepicker.setDefaults({
changeMonth: true,
changeYear: true,
dateFormat: "dd.mm.yy",
minDate: 0
});
$(":input[data-datepicker]").datepicker();
})
My POST action is
public ActionResult Create(FormViewModel formModel)
{
}
FormViewModel contains name and date properties. I thiks Model binder is not bind date. because name property field is true, date property is gets error.
Error: The value '18.07.2012' is not valid for EndDate.]