background preloader

Razor

Facebook Twitter

Razor DynamicNode Cheat Sheet. With the release of the updated Razor and DynamicNode features in 4.7.1 I thought it was high time that we had a cheat sheet to refer to when working with Razor.

Razor DynamicNode Cheat Sheet

The A4 PDF cheatsheet covers the following aspects DynamicNode DynamicMedia DictionaryPropertiesDOT Notation Collections Filtering & Ordering Traversing Property Checking IsHelpers Macro Parameters Types Permissions Basic Razor language features @Library helper Change Log: Version 1.3 Spelling mistakes fixed on DescendantAdded @Dictionary["alias"]Added DescendantOrSelf()Added AncestorOrSelf() Version 1.2Fixed issue with @Library.MediaById(int)Fixed spelling on .IsPosition() & .Position()

ASP.Net MVC Razor Helpers Cheat Sheet. MVC3 Razor & JQuery For Beginners. Download source - 563 KB Table of content Introduction In this article you will find the simplest way to create your first ASP.NET MVC application.

MVC3 Razor & JQuery For Beginners

This is a tutorial for absolute beginners to ASP.NET MVC. The only prerequisite for following this tutorial is that you know how to use Visual Studio, and understand HTML and C# syntax. Background What is MVC (Model-View-Controller)? Model - Classes that contain data that will be shown to the user.View - Components that will display the model to the user.Controller - Components that will handle any interaction with the user. In the web framework, the user will enter some URL to the ASP.NET MVC application, and the controller, model, and view will handle this request and return the HTML back to the user. This simple scenario of processing an MVC request is described in the following steps: In this example, I will show how you can create a simple application that allows you to list and manage user details using ASP.NET MVC using the Razor syntax. <! Razor Syntax. This article gives you an overview of programming with ASP.NET Web Pages using the Razor syntax.

Razor Syntax

ASP.NET is Microsoft's technology for running dynamic web pages on web servers. This articles focuses on using the C# programming language. What you'll learn: The top 8 programming tips for getting started with programming ASP.NET Web Pages using Razor syntax. Basic programming concepts you'll need. Software versions ASP.NET Web Pages (Razor) 3 This tutorial also works with ASP.NET Web Pages 2. The Top 8 Programming Tips This section lists a few tips that you absolutely need to know as you start writing ASP.NET server code using the Razor syntax. Note The Razor syntax is based on the C# programming language, and that's the language that's used most often with ASP.NET Web Pages. You can find more details about most of these programming techniques later in the article. 1. The @ character starts inline expressions, single statement blocks, and multi-statement blocks:

C# Razor Syntax Quick Reference. I gave a presentation to another team at Microsoft yesterday on ASP.NET MVC and the Razor view engine and someone asked if there was a reference for the Razor syntax.

C# Razor Syntax Quick Reference

It turns out, there is a pretty good guide about Razor available, but it’s focused on covering the basics of web programming using Razor and inline pages and not just the Razor syntax. So I thought it might be handy to write up a a really concise quick reference about the Razor syntax. Notice in the “mixing expressions and text” example that Razor is smart enough to know that the ending period is a literal text punctuation and not meant to indicate that it’s trying to call a method or property of the expression.

Let me know if there are other examples you think should be placed in this guide. I hope you find this helpful. UPDATE 12/30/2012:I’ve added a few new examples to the table of new additions to Razor v2/ASP.NET MVC 4 syntax. Also, if you want to know more, consider buying the Progamming ASP.NET MVC 4 book. Career Yogiz: C# Razor Syntax Quick Reference.