Develop an ASP.NET Website using WebMatrix
page 4 of 5
by Vanessa Smith
Feedback
Average Rating: 
Views (Total / Last 10 Days): 30895/ 48

Introduction to Dynamic Content and Razor Syntax

Dynamic content can be added to your website with the assistance of helpers within the code. Helpers are part of the ASP.NET Helpers Library that must be installed prior to use. Helpers are often a single line of code. For example, to add a Twitter feed to a website, the helper code is as simple as:

< h1 >Twitter Feed< /h1 >
@Twitter.Profile(“Microsoft”)
< /body >

Another helper to WebMatrix content is Razor Syntax. Razor Syntax is an easy-to-use, server-based programming syntax that is embedded in a web page. This ASP.NET-based syntax relies on the Microsoft .NET programming framework and can be used in the development of a wide range of web content.

Razor Syntax code can be imbedded in the following three ways:

1.       As an inline expression using “@”.

@[expression]

2.       As a single statement block.

@{var VariableOne = "Hello World!";}

3.       As a multi-statement block.

@{
string VariableTwo = VariableOne + " Today is: " + @DateTime.Now;
}

Those familiar with C, C++, C#, JavaScript, or Visual Basic should do well with RazorSyntax. Microsoft provides extensive online and published resources and support towards the use of this language. The ASP.NET website is a good place to start. For those starting with Razor Syntax, an excellent online resource can again be found at the Microsoft ASP.NET website.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2021 ASPAlliance.com  |  Page Processed at 2021-03-02 12:04:58 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search