model view controller - MVC datatype.datetime has value but does not display it -


input class = "text box one-line" data-val = "correct" data-val-date = "field bill Date must be a date. "Data-Val-Required =" Date of the bill is required "id =" billatet "name =" bill date "type =" date "value =" 22.02.2012 "

Here is the html code shown in the source on Chrome. But there is no value in the textbox.

And here is my model for "BillDate" <[p>

  [required] [display (name = "bill date")] [datatype (datatype.dat, error message = "Not a valid date")] [display format (applied formet intitmod = true, data format string = "{0: dd.m.mi.i}}")] public datetime billing {set; get; }   

And likewise I'm trying to show it @ Html.EditorFor (model = & gt; model.BillDate)

Would you please help me ...

I had this exact same problem I was watching HTTP post Was returning to the post and in the post, the date format was Yayana-MM-DD.

I changed my data annotation for it and it worked ...

  [DisplayFormat (ApplyFormatInEditMode = true, DataFormatString = "{0: yyyy-MM-dd } "))]   

Hope that helps!

Comments