ASP.Net MVC C# Chrome not showing date in edit mode

asp.net, asp.net-mvc, asp.net-mvc-3, c#, google-chrome

Solution

Try removing `[DataType(DataType.Date)]` because I believe this creates `<input type="date" />`. If you do that you'll end up with a `<input type="text" />` to which you can attach jQuery date-picker.

Try w3schools: input type date in different browsers to see the difference.

Edit:

In the past I used the following in my `View` to make this work with jQuery date-picker (if you're interested in using it).

`@Html.TextBoxFor(model => model.DateOfBirth, @"{0:yyyy\/MM\/dd}", new { @class = "datepicker" })`

Problem

I am using Google Chrome V28 as my browser - and have a problem with the DataAnnotations on my model, which force Chrome to use it's own inbuild calendar when rendering a datatime type in my view. My model is: ``` public class ObScore { public int ObScoreId { get; set; } ... ... [DisplayFormat(DataFormatString = "{0:dd MMMM yyyy}", ApplyFormatInEditMode = true)] [Display(Name = "Date")] [DataType(DataType.Date)] public DateTime Date { get; set; } ... ... } ``` There is definitely data in the model: ...but when displaying in Edit mode, Chrome shows: Is this a known bug in Chrome, and is there anything I can do in my code, to force the date into the form? Thanks, Mark

Original source

Related problems