I am kind of stumped because, I want to format the value and add a html attribute for css class.
If I use @Html.TextBoxFor(m => m.DateModified)
- I can add html attribute but formatting does not work via DisplayFormat attribute on the member.
If I use @Html.EditorFor(m => m.DateModified)
- Formatting works but I cannot add html attribute
If I use @Html.TextBox("DateModified", Model.DateModified, ...)
- I get null reference exception when Model is null when the form is in add mode
What is the best way to achieve this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…