1 / 10

Best Practices on ASP.NET AJAX

Best Practices on ASP.NET AJAX. Bill Xie Jan 30, 2010 @ CSU Fullerton SoCal Code Camp. 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

Télécharger la présentation

Best Practices on ASP.NET AJAX

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. 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 Cont’d • 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-magazine.com/Article.aspx?quickid=0907091 Search bill xie • Contact me -- billsheh@hotmail.com

More Related