Code With Examples

Razor Markup in ASP.NET

razor-markup
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 = “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>

About the author

TechPro Free

Techprofree.com is Platform which offers Free download latest project source code in java, android, php, html, c# .net, c/c++, iphone, vb, python, jsp, asp .net, all programming lanugage.

Leave a Comment