Monday, February 9, 2015

Mobile Post 1

Mobile

In the gadget, just add your link scheme by adding your parent links and child links (see above) and save your arrangement.

Note: Both the ways above (2) and (3) gives the same result for the menu.

Hope you learnt the basics of horizontal menu creation.Just experiment with the colors, font size, display properties, etc using W3schools website as your reference sheet and create your own unique horizontal menu for your blogger blog. If you have enjoyed this post, do subscribe to my blog for more useful blogger tips :)
PS: Thank you Bhawya of Bhawish's Kitchen for requesting me to write this post about Horizontal Drop Down Menu

Friday, March 14, 2014

Razor

ASP.NET Web Pages - Adding Razor Code


In this tutorial we will use Razor markup with C# and Visual Basic code

What is Razor?

  • Razor is a markup syntax for adding server-based code to web pages
  • Razor has the power of traditional ASP.NET markup, but is easier to learn, and easier to use
  • Razor is a server side markup syntax much like ASP and PHP
  • Razor supports C# and Visual Basic programming languages

Adding Razor Code

Remember the web page from previous chapter:
<!DOCTYPE html>

<html lang="en">
<head>
   <meta charset="utf-8" />
    <title>Web Pages Demo</title>
</head>
<body>
    <h1>Hello Web Pages</h1>
</body>
</html>
Now add some Razor code to the example:

Example

<!DOCTYPE html>

<html lang="en">
<head>
     <meta charset="utf-8" />
     <title>Web Pages Demo</title>
</head>
<body>
     <h1>Hello Web Pages</h1>
     <p>The time is @DateTime.Now</p>
</body>
</html>

Run example »
The page contains ordinary HTML markup, with one addition: the @ marked Razor code.
The Razor code does all the work of determining the current time on the server and display it. (You can specify formatting options, or just display the default)

Main Razor Syntax Rules for C#

  • Razor code blocks are enclosed in @{ ... }
  • Inline expressions (variables and functions) start with @
  • Code statements end with semicolon
  • Variables are declared with the var keyword
  • Strings are enclosed with quotation marks
  • C# code is case sensitive
  • C# files have the extension .cshtml

C# Example

<!-- Single statement block -->
@{ var myMessage = "Hello World"; }

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

<!-- Multi-statement block -->
@{
var greeting = "Welcome to our site!";
var weekDay = DateTime.Now.DayOfWeek;
var greetingMessage = greeting + " Today is: " + weekDay;
}

<p>The greeting is: @greetingMessage</p>

Run example »


Main Razor Syntax Rules for VB

  • Razor code blocks are enclosed in @Code ... End Code
  • Inline expressions (variables and functions) start with @
  • Variables are declared with the Dim keyword
  • Strings are enclosed with quotation marks
  • VB code is not case sensitive
  • VB files have the extension .vbhtml

Example

<!-- Single statement block  -->
@Code dim myMessage = "Hello World" End Code

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

<!-- Multi-statement block -->
@Code
dim greeting = "Welcome to our site!"
dim weekDay = DateTime.Now.DayOfWeek
dim greetingMessage = greeting & " Today is: " & weekDay
End Code


<p>The greeting is: @greetingMessage</p>

Run example »


More About C# and Visual Basic

If you want to learn more about Razor, and the C# and Visual Basic programming languages, go to the Razor section of this tutorial

Web Page

What is Web Pages?

Web Pages is one of the 3 programming models for creating ASP.NET web sites and web applications.
The other two programming models are Web Forms and MVC (Model, View, Controller).
Web Pages is the simplest programming model for developing ASP.NET web pages. It provides an easy way to combine HTML, CSS, JavaScript and server code:
  • Easy to learn, understand, and use
  • Built around single web pages
  • Similar to PHP and Classic ASP
  • Server scripting with Visual Basic or C#
  • Full HTML, CSS, and JavaScript control
Web Pages is easy extendable with programmable Web Helpers, including database, video, graphics, social networking and much more.

Web Pages Tutorial

If you are new to ASP.NET, Web Pages is the perfect place to start.
In our Web Pages tutorial you will learn how to combine HTML, CSS, JavaScript and server code, using the latest Razor server markup syntax with Visual Basic or C# .
You will also learn how to extend your web pages with programmable Web Helpers.

Web Pages Examples

Learn by examples!
Because ASP.NET code is executed on the server, you cannot view the code in your browser. You will only see the output as plain HTML.
At W3Schools every example displays the hidden ASP.NET code. This makes it easier for you to understand how it works.
Web Pages Examples

Web Pages References

At the end of this tutorial you will find a complete set of ASP.NET references with objects, components, properties and methods.
Web Pages References

We Have Used WebMatrix

In this tutorial, we have used WebMatrix.
WebMatrix is a simple but powerful free ASP.NET development tool from Microsoft, tailor made for Web Pages.
WebMatrix contains:
  • Web Pages examples and templates
  • A web server language (Razor using VB or C#)
  • A web server (IIS Express)
  • A database server (SQL Server Compact)
  • A full web development framework (ASP.NET)
With WebMatrix you can start from scratch with an empty web site and a blank page, or build on open source applications from a "Web Application Gallery". Both PHP and ASP.NET applications are available, such as Umbraco, DotNetNuke, Drupal, Joomla, WordPress and many more. WebMatrix also has built-in tools for security, search engine optimization, and web publishing.
The skills and code you develop with WebMatrix can seamlessly be transformed to fully professional ASP.NET applications.

ASP.Net

ASP.NET is a development framework for building web pages and web sites with HTML, CSS, JavaScript and server scripting.
ASP.NET supports three different development models:
Web Pages, MVC (Model View Controller), and Web Forms:

Classic ASP - Active Server Pages

Active Server Pages (ASP), also known as Classic ASP, was introduced in 1998 as Microsoft's first server side scripting engine.
ASP is a technology that enables scripts in web pages to be executed by an Internet server.
ASP pages have the file extension .asp, and are normally written in VBScript.
If you want to learn Classic ASP

ASP.NET

ASP.NET is a new ASP generation. It is not compatible with Classic ASP, but ASP.NET may include Classic ASP.
ASP.NET pages are compiled, which makes them faster than Classic ASP.
ASP.NET has better language support, a large set of user controls, XML-based components, and integrated user authentication.
ASP.NET pages have the extension .aspx, and are normally written in VB (Visual Basic) or C# (C sharp).
User controls in ASP.NET can be written in different languages, including C++ and Java.
When a browser requests an ASP.NET file, the ASP.NET engine reads the file, compiles and executes the scripts in the file, and returns the result to the browser as plain HTML.

ASP.NET Razor

Razor is a new and simple markup syntax for embedding server code into ASP.NET web pages, much like Classic ASP.
Razor has the power of traditional ASP.NET, but is easier to use and easier to learn.

ASP.NET Programming Languages

This tutorial covers the following programming languages:
  • Visual Basic (VB.NET)
  • C# (Pronounced C sharp)

ASP.NET Server Technologies

This tutorial covers the following server technologies:
  • Web Pages (with Razor syntax)
  • MVC (Model View Controller)
  • Web Forms (traditional ASP.NET)

ASP.NET Development Tools

ASP.NET supports the following development tools:
  • WebMatrix
  • Visual Web Developer
  • Visual Studio
This tutorial uses WebMatrix for Web Pages, and Visual Web Developer for MVC and Web Forms.

ASP.NET File Extensions

  • Classic ASP files have the file extension .asp
  • ASP.NET files have the file extension .aspx
  • ASP.NET files with Razor C# syntax have the file extension .cshtml
  • ASP.NET files with Razor VB syntax have the file extension .vbhtml