Link to home
Start Free TrialLog in
Avatar of Bryant Farley
Bryant Farley

asked on

@Html.EditorFor displays mm/dd/yyyy rather than date

My model has a field, CloseDate, defined as datetime.

        [Display(Name = "Close date")]
        [DataType(DataType.Date)]
        public Nullable<System.DateTime> CloseDate { get; set; }

Open in new window


It's displayed on my Edit page as follows:

@Html.EditorFor(model => model.TargetedFundingCloseDate)

Open in new window


If I enter or select a date, and click Save, the value is saved to my database. However, when the record is again displayed in Edit, I see the same mm/dd/yyyy placeholder that I did when CloseDate was null; and if I click Save, my originally selected date is saved as null.

User generated image
What can I do to get around this? Have I missed something basic?
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bryant Farley
Bryant Farley

ASKER

Thank you - had missed something very basic, as suspected.