Wednesday, May 16, 2012

ASP.NET MVC Razor and jQuery


These are my thoughts, learnings and insights from the ASP.NET MVC Razor and jQuery session at the GIDS .NET 2012 in Bangalore.

Speaker - Ido Flatow (Senior Architect – Sela Group)
ASP.NET MVC is a new framework for building web applications using the power of ASP.NET.
MVC is all about
·         Clear separation: Model, View, Controller
·         Making testing easier and comprehensive
·         Giving full control over HTML and JavaScript
·         Using friendly URLs
Page life cycle of MVC
What is Razor?
Many ASP.NET Web pages have C# or VB code blocks in the same place as HTML markup. In some occasions this combination is uncomfortable for writing and delimiting code. To deal with that problem, Razor was designed as an easy to learn, compact and expressive view engine that enables a fluid coding workflow.
Razor is not a new programming language itself, but uses C# or Visual Basic syntax for having code inside a page without ASP.NET delimiter: <%= %>. Razor file extension is ‘cshtml’ for C# language, and ‘vbhtml’ for Visual Basic.
Examples:
@’ is the magic character that precedes code instructions.
A single code line inside the markup:
Current time is: @Datetime.Now
What is jQuery? It’s Fantastic!
ü Fast and concise JavaScript library
ü Simplifies your code
o    DOM traversing
o    Event handling
o    Animation
o    Ajax interaction
ü Included in ASP.NET 4 project templates
ü Cross browser (IE/FF/Safari/Opera/Chrome)
ü Extensible through plugins
ü Write less, do more!
ü It just works!
Interesting fact – around 42% in the world use jQuery compared to its competitors
There is lot more to know and appreciate of these tools and technologies which I’ll try to cover in my upcoming blogs. Here I wrap up the topic with a comparison of ASP.

No comments: