680 likes | 792 Views
Discover how to create attractive, standards-compliant rich internet applications using ASP.NET MVC 2 and jQuery. This session covers the benefits of using ASP.NET for modern web apps, highlights the power of MVC architecture, and demonstrates the integration of jQuery for enhanced interactivity. Explore a typical Zen request anatomy, learn how to define routes in XML for efficient action handling, and utilize metadata for responsive design. Engage with practical code examples and transform your web application development experience.
E N D
Building a Next-Generation Web Applicationwith ASP.NET MVC 2 and jQuery Nate Kohari Co-Founder / CTO Enkari, Ltd. nate@enkari.com
ASP.NET is a great platform for building attractive, standards-compliant rich internet applications
You can build rich internet applications without Silverlight or Flash
Anatomy of a typical Zen request
HTML/JavaScript ASP.NET MVC
Zen.Ui.StoryCard = new JS.Class({ func1: function() { ... }, func2: function() { ... } }); var card = new Zen.Ui.StoryCard();
$(“.story-card”).attach( Zen.Ui.Behaviors.StoryCard);
Find all elements with the CSS class story-card… $(“.story-card”).attach( Zen.Ui.Behaviors.StoryCard);
$(“.story-card”).attach( Zen.Ui.Behaviors.StoryCard); …and apply the appropriate behavior
Which card did the user move?
(story card) <li data-projectid=“123” data-storyid=“456”> ... </li> HTML5 data-* attributes
(story card) <li data-projectid=“123” data-storyid=“456”> ... </li> HTML5 data-* attributes { projectid: 123, storyid: 456 } JSON read via Metadata Plugin
Where should we send the request?
One Action = One Route (“route-per-action”)
Routes defined in XML: <app> <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ... </app>
Routes defined in XML: <app> <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ... </app> …at app start, parsed & registered in RouteTable
Routes defined in XML: <app>(area) <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ... </app>
Routes defined in XML: <app> <project> (controller) <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ... </app>
Routes defined in XML: <app> <project> <route action=“move” pattern=“project/{projectid}/story/{storyid}/move” verbs=“post”/> ... </project> ... </app>
Url.Action(“move”, “story”, new { projectid = 123, storyid = 456 })
Url.Action(“move”, “story”, new { projectid = 123, storyid = 456 }) http://agilezen.com/projects/123/story/456/move
But wait… we need the route in JavaScript!
urlfor(“move”, “story”, { projectid: 123, storyid: 456 })
urlfor(“move”, “story”, { projectid: 123, storyid: 456 }) http://agilezen.com/projects/123/story/456/move
urlfor(“move”, “story”, { projectid: 123, storyid: 456 }) Metadata read from story card <li>
HTML/JavaScript ASP.NET MVC