1 / 18

ASP.NET AJAX (Juggling) Patterns

ASP.NET AJAX (Juggling) Patterns. Steve Marx Technical Evangelist Microsoft Corporation. Session Objectives. A Deeper look at AJAX and ASP.NET AJAX Patterns for implementing AJAX scenarios Using partial rendering and Web services together Enhancing page navigation model

yered
Download Presentation

ASP.NET AJAX (Juggling) Patterns

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP.NET AJAX (Juggling) Patterns Steve Marx Technical Evangelist Microsoft Corporation

  2. Session Objectives • A Deeper look at AJAX and ASP.NET AJAX • Patterns for implementing AJAX scenarios • Using partial rendering and Web services together • Enhancing page navigation model • Unobtrusive inclusion of script functionality • Lots of demos...

  3. AJAX: Beyond the Hype • Improving end-user perception and usability • Faster, smoother, intuitive • Visually appealing • Personalized • Improving network/bandwidth usage • Partial rendering • Light-weight web service calls • Improving development approach to scripting • Namespaces, interfaces, inheritance • Properties, events, dispose

  4. DEMO AJAX = Asynchronous Juggling And XAML

  5. Partial Rendering • Preserves postback programming model • UpdatePanels declare regions to update • Easy and declarative • Stateful (equivalent to a postback) Init Load State Process Postback Form Data + Custom Header Load Form Submit Click Postback Events Partial Rendering Response Save State PageRequestManager PreRender Render Unload

  6. DEMO Optimizing UpdatePanel Usage

  7. What did we see? • Optimize what to update and when • UpdateMode=“Conditional” • Use triggers, Update() for granular control • Postbacks are still postbacks • Which user actions should be postbacks? • Carefully evaluate AutoPostBack • Consider alternative means of interactivity

  8. Logical Navigation • Postbacks flood navigation history with intermediate steps • AJAX-based pages often have no history • Back button goes the whole way back to the previous page • How can we improve navigation? • App defines a set of logical views • App controls which updates transition between views • Logical views added to navigation history • Bonus: bookmarking and indexing

  9. DEMO Logical Navigation

  10. Structured Scripting • Increased client UI logic requires structured approach to scripting • No more ad-hoc global variables, functions • OOP-like scripting system • Script separate from content • Better designer/developer workflow • Easier to preserve core behavior when script is disabled • “Behaviors” enable unobtrusive script attachment

  11. DEMO SelectableBehavior

  12. Web Services • Data and operations exposed as web services • Support for SOAP (.asmx) and RESTful models • JSON format, object serialization • Higher-level networking stack • Sys.Net.WebRequest – abstracts XMLHttpRequest • Script proxies for .asmx enable simple method call model • Ideal for stateless requests • Lean wire format • Generally useful in client-centric apps • Alternative to partial updates where appropriate

  13. DEMO Incorporating Web Services

  14. UpdatePanel or Services? • Complementary models • Partial rendering – when you need state, server-side control logic • Pros: easy to use, control properties, page state • Cons: full postback, one at a time • Web services – when your logic is stateless • Pros: light-weight, parallel • Cons: need to write necessary code to package UI as parameters

  15. What about search? • We have data in a database • I want Google/Live/Yahoo to see it… • But there’s JavaScript in between! • Answer: search sitemaps

  16. DEMO Let’s be searchable!

  17. Summary • AJAX enables rich, next-generation apps • ASP.NET AJAX makes it easy • Integrate AJAX patterns into ASP.NET model • Simple out-of-the-box functionality • Solid platform with extensibility to go further

  18. Resources • AJAX homepage: http://ajax.asp.net • Blogs • http://smarx.com – me • http://nikhilk.net – Nikhil Kothari • http://weblogs.asp.net/scottgu – Scott Guthrie • http://weblogs.asp.net/bleroy – Bertrand LeRoy • http://blogs.msdn.com/brada – Brad Abrams • http://www.shankun.com – Shanku Niyogi

More Related