I have an editor template for a custom object. Pretty basic - just has a bunch of strings and dates:
<%:Html.LabelFor(model => model.AString)%>
<%:Html.TextBoxFor(model => model.AString)%>
<%:Html.LabelFor(model => model.ADate)%>
<%:Html.EditorFor(model => model.ADate)%>
<%:Html.LabelFor(model => model.AnotherDate)%>
<%:String.Format("{0:d}", Model.AnotherDate)%>
This is stored in the Shared/EditorTemplates folder. I also have a DateTime.ascx editor template in the same location, to override ALL datetime fields.
As you can see in the code above, one of the date fields uses an EditorFor
for the date field, the other does not. However, they both render the same, which leads me to believe the DateTime editor is not being accessed. Is there anything I'm doing wrong? Seems like this should be possible to do.
I've used the DateTime editor directly in a view, and it works fine.
Thanks for any help or insight.