>

Formatted Display


The _D helper renders a property in display only mode with the format specifications contained either in its Mvc Controls Toolkit  FormatAttribute or in its  standard Asp.net Mvc DisplayFormatAttribute.

Enumerations and booleans may be displayed with either strings or images declared into arrays of possible values. Below an example that displays a boolean with the yes/no strings:

h.DeclareStringArray(
    new string[] { "no""yes" }, 
    "standardBoolean"
    true);
...
...
...

.CustomTemplateFixed(TemplateType.DetailDisplay,
@<div class="ui-widget-content custom-column">
    <h4>@item.LabelFor(m => m.EnableComments)</h4>
    @item._D(m => m.EnableComments, null"standardBoolean")
    &nbsp;
    <h4>@item.LabelFor(m => m.Publish)</h4>
    @item._D(m => m.Publish, null"standardBoolean")
</div>)