Professional Documents
Culture Documents
PM self-guided labs
Prerequisites:
Laptop with Web Platform Installer, Visual Studio 2010 Express or higher, ASP.NET 4 Downloads all available on www.webcamps.ms
Jon Galloway
Community Program Manager @jongalloway weblogs.asp.net/jgalloway
Day 2
Self-led labs on ASP.NET MVC 3
Session 1 - Agenda
The Microsoft Web Platform Web Platform Installer & WebMatrix ASP.NET MVC
What is MVC? Using Models, Views and Controllers Razor
The Microsoft Web Platform combines a rich and powerful web application framework with a supporting cast of tools, servers, technologies and applications for creating, designing, developing and delivering web solutions.
I m a professional software developer and I build complex, large scale web sites with a team of developers
I <3 Web Apps. I just need a tool that makes them easier to configure, customize and publish them
I want to build web sites myself with an easy to learn tool and framework
ASP.NET Core
Caching Pages
ASP.NET Web Forms Intrinsics
Modules Controls
ASP.NET MVC Handlers
Globalization
Razor View Engine
Profile
Roles
Cost = free; Size < 2MB Always has latest version of the platform available Available in 9 languages Web App Gallery
Umbraco, DotNetNuke, Drupal, WordPress and many more Submit your own apps, get distribution
Demonstration
Controller (Input)
View (Presentation)
Model (Data)
Response
View
Razor Syntax
@if (User.Grok(Razor)) { <div>w00t!</div> } New, Simplified View Engine Write fewer lines of code More natural mix code and markup Helpers save you time Compatible with ASP.NET Web Pages in WebMatrix
Commenting in Razor
@*
Option 1: Markup
*@
@{
Option 2: Code
@*
Option 3: Both
*@
Layout.cshtml
Page 2
Page 3
Layout Syntax
1. Define your Layout 2. Reference it in your pages
/Shared/_Layout.cshtml
<html> <head> MyPage.cshtml <title>Simple Layout</title> </head> @{ <body> Layout = "/Shared/_Layout.cshtml"; @RenderBody() RenderBody() } </body> </html> <p> My content goes here </p>
Demonstration
Q&A