Create a gist now

Instantly share code, notes, and snippets.

@if (Model == null) {
<text>@ViewData.ModelMetadata.NullDisplayText</text>
} else if (ViewData.TemplateInfo.TemplateDepth > 1) {
<text>@ViewData.ModelMetadata.SimpleDisplayText</text>
} else {
foreach (var prop in ViewData.ModelMetadata.Properties.Where(pm => pm.ShowForDisplay && !ViewData.TemplateInfo.Visited(pm))) {
if (prop.HideSurroundingHtml) {
<text>@Html.Editor(prop.PropertyName)</text>
} else {
<p>
@Html.Label(prop.PropertyName)
@Html.Editor(prop.PropertyName)
@Html.ValidationMessage(prop.PropertyName)
</p>
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment