Display templates (partial views) in MVC 3 using Razor

http://stackoverflow.com/questions/6365633/what-is-the-html-displayfor-s...

This is an excellent, easy way to have a consistent user interface. You can use display templates to default values, or give all the values of a specific type the same look and feel (or do both). For example, creating the view String.cshtml inside Views -> Shared -> DisplayTemplates will affect all strings that are rendered using:


@Html.DisplayFor()

The display template, also called a partial view looks like this:


@model string

@if ((string.IsNullOrEmpty(Model)) || (string.IsNullOrWhiteSpace(Model)))
{
    <text>(not set)</text>
}
else
{
    @Model
}

Either the string is set or the text "(not set)" is displayed if there is no value, if the value is null, or if it is only white space.

Topics:

Comments

Well written Post about Fuji. I enjoyed reading every words in it. Your blog has got many interesting posts which very nice to read. Thank you for the good and interesting post. Keep on writing.

Good article. pls keep sharing such good articles.

Players could should acquire some shark attachments that include the duration for the gold thrill of their shark. Please see to it you examine back usually for your ideal resource on hungry shark evolution, many thanks.http://hungrysharkevolution.org

The condition which composes templates enhanced or inferior than old partials are almost severely reliant on whether or not the conference http://www.seekclip.com/

Extremely details specifically the last part I care for such information and facts much. I was searching for this certain details for some time
B Tech college in punjab