Presentation is loading. Please wait.

Presentation is loading. Please wait.

Best Practices on ASP.NET AJAX Bill Xie Jan 30, CSU Fullerton SoCal Code Camp.

Similar presentations

Presentation on theme: "Best Practices on ASP.NET AJAX Bill Xie Jan 30, CSU Fullerton SoCal Code Camp."— Presentation transcript:

1 Best Practices on ASP.NET AJAX Bill Xie Jan 30, 2010 @ CSU Fullerton SoCal Code Camp

2 ASP.NET AJAX ASP.NET Web Forms Addon Not a Pure AJAX Framework -- Partial Rendering, ScriptManager, UpdatePanel Great Backward Compatibility with ASP.NET Web Forms -- apply all skills in Web Forms to AJAX application

3 ASP.NET AJAX Declarative syntax Async triggers can be any controls Support custom events Web service integration Page methods Client library A big set of ASP.NET AJAX server controls

4 Where Are The Problems Declarative syntax does not work in all cases -- UpdatePanel nested in a Repeater Lack a full picture of how UpdatePanels and Async Triggers are associated. -- Too many SEPARATE event handlers Use of complex controls as async triggers and custom events -- Repeater, GridView, User Controls, etc -- Distorting the meaning of async triggers -- Make code hard to read

5 What Are The Problems Contd Page As One Application -- Imagine more and more more and more async triggers and UpdatePanels BIG PROBLEM -- Change and Maintenance Better way to do the ASP.NET AJAX instead of the ad hoc way? -- Consistent, simple, straightforward, ….

6 Can We Solve The Problems? Fortunately, the answer is YES A reduced set of ASP.NET AJAX can do the trick The solution still keeps the pros of all ASP.NET AJAX good features, but it leads to applications much easier to change and maintenance

7 The Solution Decouple async triggers and UpdatePanels at design time -- Specify async triggers (inside UpdatePanel, page-level trigger with instance, nested) -- Wrap areas wherever you want to update in the async postback with UpdatePanel Centralized handling of async postbacks -- Identify async triggers with AsynchronousPostBackElementID -- no event handlers, if else or switch instead -- Associate UpdatePanels dynamically (ChildrenAsTriggers) Some tweaks -- GridView sorting event Demo

8 Case Studies Async Triggers Page looks simple but databinding is very complex

9 Case Studies UpdatePanels

10 Q & A You can find the technique in this article http://code- 091 Search bill xie Contact me --

Download ppt "Best Practices on ASP.NET AJAX Bill Xie Jan 30, CSU Fullerton SoCal Code Camp."

Similar presentations

Ads by Google