Date only from TextBoxFor()
- by thekronos
Hello,
I'm having trouble displaying the only date part of a datetime into a textbox using TextBoxFor<,(expression, htmlAttributes).
The model is based on Linq2SQL, field is a DateTime on SQL and in the Entity model.
Failed :
<%= Html.TextBoxFor(model => model.dtArrivalDate, String.Format("{0:dd/MM/yyyy}", Model.dtArrivalDate))%>
Ps : this trick seems to be depreciated, any string value in the object htmlAttribute is ignored.
Failed :
[DisplayFormat( DataFormatString= "{0:dd/MM/yyyy}" )]
public string dtArrivalDate { get; set; }
I would like to store and display the date part only on the details/edit view without the "00:00:00" part.
Any idea please ?
Merry Chrismas from France to all by the way ;-)