MVC 3

A month ago, MVC 3 was released. Given it’s maturity level and features, I have decided it’s time to start building web apps with it instead of web forms.

Get MVC 3.

Looking for jquery-1.4.4-vsdoc.js? Create a new MVC3 Web App (jquery-1.4.4-vsdoc.js)

Other jQuery files packaged in the project template include:

version 1.7 jQuery UI
jquery-ui.js
jquery-ui.min.js

Bonus - intellisense for the jQuery validation plug-in 1.7 (jquery.validate-vsdoc.js)

Razor HTML Helpers

I will expand/update this as I learn more about it. For now just a few examples that I wanted to document.

Razor
@using (Html.BeginForm("HandleForm", "Home")){ }

@using (Html.BeginForm("HandleForm", "Home", FormMethod.Post, new { id = "myForm" })){ }

@using (Ajax.BeginForm("HandleForm", "Home", new AjaxOptions { UpdateTargetId = "myResults" }, new { id = "myForm" })) { }

@Html.ActionLink("Detail", "Detail", new { controller = "Artist", id = 1 })

@Html.ActionLink("Detail", "Detail", new { controller = "Artist", id = 1 }, new { @class = "myClass", title = "My Link Title" })

@Html.ActionLink("Detail", "Detail", new { controller = "Artist", id = 1 }, new { id = "myId", title = "My Link Title" })

* Note the razor escape “@” before class. This is because “class” is reserved.

Output
<form action="/Home/HandleForm" method="post"></form>

<form method="post" id="myForm" action="/Home/HandleForm"></form>

<form method="post" id="myForm" data-ajax-update="#myResults" data-ajax-mode="replace" data-ajax="true" action="/Home/HandleForm?Length=4"></form>

<a href="/Artist/Detail/1">Detail</a>

<a title="My Link Title" href="/Artist/Detail/1" class="myClass">Detail</a>

<a title="My Link Title" id="myId" href="/Artist/Detail/1">Detail</a>

Links* Scott Gu’s Blog announcing the release on Jan. 13, 2011

comments powered by Disqus