Title: ASP.NET Web Programming Using The Razor Syntax
1- ASP.NET Web Programming Using The Razor Syntax
Dot Net Training
2 In this an Article, we give you an overview of
ASP.NET web programming. Even though, it includes
almost everything. Youll need to get started
with ASP.NET Web Pages. Razor Syntax, Server
Code and ASP.NET Razor syntax is a programming
syntax for implanting server-based code in a web
page. A web page that uses Razor syntax, there
are two kinds of contents server code and client
content. Client content is used in web pages
HTML markup, style information such as CSS, plain
text and some client script such as
JavaScript. Razor syntax allows you to add
server code to the client content. If theres
server code in the page, the server runs that
code first, then it sends the page to the
browser. On running on the server, the code can
perform tasks that might be more complex to do
using client content alone. To server code can
dynamically create client content it can
produce HTML markup or other content on the run
and then send it to the browser along with any
static HTML.
Dot Net Training
3 Where does ASP.NET fit in ? Razor syntax is
based on ASP.NET technology which is based on the
Microsoft .NET Framework. ASP.NET is part of the
.NET Framework and is specifically developed for
creating web applications. The Razor syntax
provides you the power of ASP.NET, using a
simplified syntax thats easier to learn if
youre are new to it and makes you more
productive if youre an expert. Classes and
Instances ASP.NET server code uses objects,
which are built on classes. The class is a
definition or template for an object. When the
application needs to work with real customer
information, it creates an instance . Each
customer is a separate instance of the Customer
class. Every instance includes the same
properties and methods, but the property values
for each instance are basically different, since
each customer object is unique.
Dot Net Training
4If a server code block has text which is not code
and that instead should be furnished as is,
ASP.NET needs to be able to distinguish that text
from code. This can be done in many ways Write
the text in an HTML element like ltpgtlt/pgt or
ltemgtlt/emgt _at_if(IsPost) // This line has content
between matched ltpgt tags. ltpgtHello, the time is
_at_DateTime.Now and this page is a postback!lt/pgt
else // All content between matched tags,
followed by server code. ltpgtHello
ltemgtstrangerlt/emgt, today is ltbr /gt lt/pgt
_at_DateTime.Now The HTML element can include
text, additional HTML elements, and server-code
expressions. When ASP.NET views the opening HTML
tag (for example, ltpgt), it furnishes everything
including the element and its content as is to
the browser.
Dot Net Training
5Use the _at_ operator or the lttextgt element. The _at_
outputs a single content containing plain text or
unmatched HTML tags the lttextgt element encloses
multiple lines to output. These options are
helpful when you dont want to render an HTML
element as part of the output. _at_if(IsPost) //
Plain text followed by an unmatched HTML tag and
server code. _at_ The time is ltbr /gt
_at_DateTime.Now ltbr/gt // Server code and then plain
text, matched tags, and more text. _at_DateTime.Now
_at_is the ltemgtcurrentlt/emgt time. a The first
example repeats the previous one but uses a
single pair of lttextgt tags to enclose the text to
render. I
Dot Net Training
6f you want to learn ASP.Net and improve yourself
in .NET training, then CRB Tech Solutions would
be of great support for you. Join us with our
upgraded program in ASP.Net course. Stay tuned
to CRB Tech reviews for more technical
optimization and other resources.
Dot Net Training
7Thank You..!
Dot Net Training