230 likes | 375 Views
Visual Studio 2010 and .NET Framework 4 Training Workshop. What’s New In ASP.NET AJAX 4. Name Title Organization Email. Agenda. Client-Side Templates Client Controls Declarative Instantiation Command Bubbling Live Bindings.
E N D
What’s New InASP.NET AJAX 4 Name Title Organization Email
Agenda Client-Side Templates Client Controls Declarative Instantiation Command Bubbling Live Bindings
“ASP.NET AJAX is alright, but it is way too server-centric for serious client-side development…” - Uninformed Guy
Common Myths ASP.NET AJAX is tied to ASP.NET, namely WebForms… You must use a ScriptManager and UpdatePanels to get anything done… It requires Visual Studio to work…
Requirements In order to seriously use ASP.NET AJAX, some need… Client-side controls Data binding UI templating Easy service communication Modular functionality
Who in their right mind wants to do manual XMLHttpRequest work, HTML generation, or data wireup?
Server vs. Client AJAX Server AJAX Initial request: HTML Rendering Rendering Form POST HTML Client AJAX HTML + JSON JSON JSON
The server should only be concerned with data, not presentation
Client Templates Server-Side (WebForms): <ItemTemplate> <li><%# Eval("Name") %></li> </ItemTemplate> Client-Side: <ul class="sys-template"> <li>{{ Name }}</li> </ul>
DataContext ASMX 1. Request WCF ADO.NET Data Services Data Context 2. JSON Data ASP.NET MVC JsonResult 3. Modify Data 4. Save Data Etc. * DataContext includes change tracking automatically
Maybe you’d prefer to write as little JavaScript as possible…
Declarative Instantiation Map: xmlns:dataview="javascript:Sys.UI.DataView“ • 2. Attach: • <div sys:attach="dataview"></div> • 3. Use: • <div … dataview:serviceuri="myService.svc"…>
Command Bubbling Server-Side (WebForms): <asp:Buttonrunat=“server” CommandName=“Select" … /> Client-Side: <button sys:command="select" … />
Live Bindings Source Target Object #1 Property #1 Property #2 Property #3 Object #2 Property #1 Property #2 Property #3 • One-Time • One-Way • Two-Way
Summary Client-Side Templates Client Controls Declarative Instantiation Command Bubbling Live Bindings