Monday, November 28, 2011

ASP.Net MVC 3 Razor View Engine

ASP.NET MVC 3 introdues a new view-engine option called “Razor” which enables you to quickly integrate server code into your HTML markup with a minimum of keystrokes. Unlike most template syntaxes, you do not need to interrupt your coding to explicitly denote server blocks within your HTML. This enables a really compact and expressive syntax which is clean, fast and fun to type. Here are the quick view related to Razor view-engine in asp.net MVC 3.0.


File Extension .cshtml for c# and vbhtml for vb.net
_(underscore) Files that cannot be shown by direct requests (master pages, partial views etc) have underscore (_) prefix in their names. e.g. _Layout.cshtml
@ start of a server side code block. It doesn’t require you to explicitly close the code-block. (short-hand of <%= %>)
@{ code } (Multi-line Statements) add multiple lines of server side code by wrapping it within a @{ code } block.
@( ) (Multi-Token Statements) enables a code block to have multiple tokens
@: to explicitly indicate the start of content in the line
<text> to render multi-line content blocks
layout page asp.net master page is recognized in MVC

Layout <file> layout we want to use within a ASP.NET MVC
@* comment *@ To define server side comment (like <%– –%>) )

@RenderBody used in layout where we want the views based on this layout to “fill in” specific body content for a requested URL.
@RenderSection define two sections within our layout that the view templates within our site can optionally choose to fill-in
@section { } To define section
@model <StrongModelType> define strongly-typed models
@ViewBag.<myData> New Dynamic Controller property, It internally stores the property name/value pairs within the ViewData dictionary. It is used to pass Data Between a Controller and a View
@tempdata To pass State Between Action Methods
Standard HTML Helpers(not a complete list)


* Html.ActionLink()

* Html.BeginForm()

* Html.CheckBox()

* Html.DropDownList()

* Html.EndForm()


* Html.Hidden()

* Html.ListBox()

* Html.Password()

* Html.RadioButton()

* Html.TextArea()

* Html.TextBox()

Other Helpers

Chart,

Crypto,

WebGrid,

WebImage,


WebMail, etc.

Enjoy ASP.NET MVC !!!



HTML5 Web Development

HTML5 development is an ongoing effort of a consortium – called the W3C Consortium – comprising of many software developers and other interested industry groups to update and revise Hypertext Markup Language (HTML), which is the core language at the heart of the World Wide Web. The Web Hypertext Application Technology Working Group (WHATWG) started work on HTML5 in 2004 which is being edited by Ian Hickson of Google, Inc and David Hyatt of Apple. The HTML5 specification standard is in various draft states at at W3C (World Wide Web Consortium) which began working with the WHATWG draft of HTML5 in early 2007.



As with almost any processes run by a big committee, or group of committees, HTML5 development is running behind its originally envisioned schedule for completion. While some parts of the HTML5 specification are stable and being implemented in new products, the entire HTML5 project is not expected to be complete until as late as 2022. Having an industry standard agreed upon by all participants is the goal of this complex undertaking. Every participant has their own motives. For example, Apple is looking at a standard that can be seen as a replacement for Adobe’s Flash.



HTML5 development is intended to produce a workable open source platform that can be used in browser applications throughout the internet by multiple vendors so that anyone can contribute to the development of new applications and no single vendor will have control over specific aspects of the internet. HTML5 could potentially make plug-ins like Adobe Flash, JavaFX, and Microsoft Silverlight obsolete, as the new platform is expected to incorporate streaming video capabilities into browser applications without the need of Adobe Flash, JavaFX or Microsoft Silverlight.



Despite the long term development schedule, some aspects of HTML5 are already being implemented in new Browsers. Firefox 3.5, Google Chrome, and Microsoft Internet Explorer 8 all incorporate some features of HTML5. Canvas technology, invented by Apple, is a 2-D browser based graphics feature. Canvas has been included in Opera Software’s new browser. Opera plans to implement HTML5 video capabilities in its browser soon. Apple’s Safari browser supports Canvas and also has some HTML5 video and audio features built into it already.



As an effort to produce a uniform standard for all web browser development, HTML5 has many strengths and weaknesses. The long time required for completion of the project reflects the complexity of the effort. The fact that all of the major players in the internet technology industry are involved in the project is a big plus, but it also causes some potential problems as each player comes with their own agenda.



For example, trying to incorporate video capabilities into browsers without the need for proprietary plug-ins such as Flash or Silverlight threatens Google’s interests in YouTube, which relies on Flash technology, and Microsoft, which has a huge investment in Silverlight. Apple is heavily involved in trying to incorporate HTML5 into many of its mobile browser applications. Its Sproutcore framework is intended to speed the development of applications based entirely upon web standards without the necessity of external plug-ins. As HTML5 continues to evolve, it will simplify development of applications that will be compatible with all web browsers.