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 = “www.techprofree.com”; }
<!– Inline expression or variable –>
<p>The value of myMessage is: @myMessage</p>
<!– Multi-statement block –>
@{
var greeting = “www.techprofree.com!”;
var weekDay = DateTime.Now.DayOfWeek;
var greetingMessage = greeting + ” Today is: ” + weekDay;
}
<p>The greeting is: @greetingMessage</p>
Leave a Comment