Skip to content

Instantly share code, notes, and snippets.

@CraigCav
Created November 22, 2011 02:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CraigCav/1384742 to your computer and use it in GitHub Desktop.
Save CraigCav/1384742 to your computer and use it in GitHub Desktop.
@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