Code With Examples

Razor Markup in ASP.NET

Written by TechPro Free

Razor Markup in ASP.NET

To embedding server code in C# or in VB .NET you may use Razor, it’s really simple markup syntax for ASP.NET web pages.


ViewBag.Title = “Home Page”;
<!– Single statement block –>
@{ var myMessage = “”; }

<!– Inline expression or variable –>
<p>The value of myMessage is: @myMessage</p>

<!– Multi-statement block –>
var greeting = “!”;
var weekDay = DateTime.Now.DayOfWeek;
var greetingMessage = greeting + ” Today is: ” + weekDay;
<p>The greeting is: @greetingMessage</p>

About the author

TechPro Free is Platform which offers Free download latest project source code of ALL Programming Languages.

Leave a Comment