MVC3 -Razor syntax sample

Implicit Code Expression

<span>@model.Message</span>

Explicit Code Expression


<span>ISBN@(isbn)</span>

Unencoded Code Expression

<span>@Html.Raw(model.Message)</span>

Code Block

@{

int x = 123;

string y = “because.”;

}

Combining Text and Markup

@foreach (var item in items) {

 <span>Item @item.Name.</span>

 }

Mixing Code and Plain Text

@if (showMessage) {

 <text>This is plain text</text>

 }

or

@if (showMessage) {

 @:This is plain text.

 }

Escaping the Code Delimiter

My Twitter Handle is &#64;hacked

or

My Twitter Handle is @@haacked

Server Side Comment

@*

 This is a multiline server side comment.

 @if (showMessage) {

 <h1>@ViewBag.Message</h1>

 }

 All of this is commented out.

 *@

Calling a Generic Method

@(Html.SomeMethod<AType>())

6/4/2013 5:31:46 PM #

hd pvr

Thanks for the auspicious writeup. It actually was a entertainment account it. Look complex to more added agreeable from you! However, how can we keep up a correspondence?

my website ...  hd pvr - http://www.hdpvr.net/

hd pvr