Basically I have a custom built "Date" class "EndDate" in my MVC output model. FYI: The "Date" class builds of DateTime but hides the time functionality. I've created a display template for this Date type that formats the date nicely but in once instance (shown below) if the object is null (in this case for EndDate) I would like the text "No End Date Specified" output instead.
<%:Html.DisplayFor(m => m.EndDate)%>
I can't change the display template as thats common for all instances of the Date object, I don't really want to change the model itself either. Basically I want something like:
<%:Html.DisplayFor((m => (m.EndDate == null) ? "No End Date Specified" : m.EndDate)%>
Is the above possible in any form? If not, what would be a better way to implement this functionality. I guess even if there is a way to do this, if it's not a good idea please let me know why not and any better way of doing this