140 likes | 308 Views
AJAX. MIS 424 Professor Sandvig. Today. What is AJAX Benefits & Uses Implementation Do-it-yourself Download API ASP.NET Ajax Summary. What is AJAX. Acronym A synchronous J avaScript A nd X ML What it is JavaScript in web page retrieves data from server Data format is XML
E N D
AJAX MIS 424 Professor Sandvig
Today • What is AJAX • Benefits & Uses • Implementation • Do-it-yourself • Download API • ASP.NET Ajax • Summary
What is AJAX • Acronym • Asynchronous JavaScript And XML • What it is • JavaScript in web page retrieves data from server • Data format is XML • Allows partial page refresh • Reduces need to refresh entire page
Benefits & Uses • Benefits: • Richer experience for user • More like using desktop application • Uses • Google Suggest • Google Maps • Cascading Menus (Kelly Blue Book) • REI product image (menu is JavaScript) • Google Docs • etc. etc.
Implementation Options: • Do-it-yourself • Lightweight, flexible • write or modify JavaScript or jQuery • Use API • Google, Yahoo, Highslide, … • ASP.NET AJAX • drag & drop in VS • convenient • adds a lot of code to application
Do it yourself • Client • Include JavaScript or jQuery in web page • Requests data from server • Server • Web service provides data • Format: XML, JSON, HTML, …
Do it yourself • Benefits • Flexible • Lightweight • Drawbacks • Time consuming • Some knowledge of JavaScript/jQuery
Use AJAX API • Ajax applications written by others • Google AJAX APIs • Search • Maps • Calendar • Facebook APIs
ASP.NET AJAX • ASP.NET provides built-in AJAX functionality • Two flavors: • Built into some Data Controls • Limitations • ScriptManager & Update Panel • Very flexible
Server Controls • Built in AJAX functionality • GridView, DetailsView, FormView • Property: AllowSortingAndPagingCallbacks • Benefits • Easy to implement • Limitations: • Controls cannot use templates • Inefficient: retrieves all data and discards extra
UpdatePanel • UpdatePanel • Wrap any server controls • Become AJAX enabled • Benefits • Easy to implement • Flexibility • Mix & match controls • Specify triggers
Update Panel • Disadvantage • JavaScript cannot be tweaked • Fine if it meets your needs • Heavy • All controls are repopulated • Viewstate also sent/received • Example: • Cascading Dropdown: • AjaxAspNet.aspx
Summary • AJAX • Use to improve user experience • Partial page refreshes • Options: • Code you own • Use APIs • ASP.NET AJAX