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))%>
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 only the date part on the details/edit view, without the "00:00:00" part.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…