Date Format using Html.DisplayFor() in MVC5
问题 Referencing the answer in this post I added /Views/Shared/DisplayTemplates and added a partial view called ShortDateTime.cshtml as shown below: @model System.DateTime @Model.ToShortDateString() When the model contains a value this works and the formatted date is displayed correctly: @Html.DisplayFor(modelItem => item.BirthDate, "ShortDateTime") However, if a null value is returned a 'System.InvalidOperationException' is thrown. Indicating: {"The model item passed into the dictionary is null,