mvc crib sheet

Hands-On Labs

 

 

Razor

 

c# code

 

@Html.ActionLink(“Edit”, Edit”, new {id=item.ID})

 

 

implicit code

 

@items

 

Code block

 

@{

       Html.ActionLink(“Edit”, Edit”, new {id=item.ID})

}

 

 

Displaying text inside a code block

 

 

<Text>Review</Text>

 

 

Explicit expression using brackets

 

@(item.Rating)

 

 

This is an email address

 

K@item.Rating

 

if you use an explicit expression you’ll display the values

 

K@(item.Rating)

 

 

 

If you want 

 

@OdeToCode 

 

you can ESC by using 

 

@@OdeToCode