Can a custom Template editor call the default EditorTemplate for the same model inside it? The same goes for DisplayTemplates. Here is a simplified example. While LabelForModel is displayed, neither DisplayForModel nor EditorForModel are displayed.
View
<div class="highlight1"> @Html.DisplayFor(m => m.NullableProp, "NullableIntType1View") </div> <div class="highlight2"> @Html.EditorFor(m => m.NullableProp, "NullableIntType1View") </div> <div class="highlight1"> @Html.DisplayFor(m => m.NullableProp, "NullableIntType2View") </div> <div class="highlight2"> @Html.EditorFor(m => m.NullableProp, "NullableIntType2View") </div>
General / DisplayTemplates / NullableIntType1.cshtml
@model System.Int32? This is display for NullableIntType1 <hr /> --> @Html.EditorForModel() <-- <hr /> --> @Html.DisplayForModel() <-- <hr /> --> @Html.LabelForModel() <--
General / EditorTemplates / NullableIntType1.cshtml
@model System.Int32? This is editor for NullableIntType1 <hr /> --> @Html.EditorForModel() <-- <hr /> --> @Html.DisplayForModel() <-- <hr /> --> @Html.LabelForModel() <--
General / DisplayTemplates / NullableIntType2.cshtml
@model System.Int32? This is display for NullableIntType2 <hr /> --> @Html.EditorForModel() <-- <hr /> --> @Html.DisplayForModel() <-- <hr /> --> @Html.LabelForModel() <--
General / EditorTemplates / NullableIntType2.cshtml
@model System.Int32? This is editor for NullableIntType2 <hr /> --> @Html.EditorForModel() <-- <hr /> --> @Html.DisplayForModel() <-- <hr /> --> @Html.LabelForModel() <--
source share