september 10 – 13 • kuala lumpur
DESCRIPTION
TRANSCRIPT
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 1
September 10 – 13 • Kuala Lumpur
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 2
AJAX in General
Introducing ASP.NET AJAX
Using ASP.NET AJAX Server Controls
Consuming Web Services & Page Methods
Accessing ASP.NET Application Service using AJAX
ASP.NET AJAX Control Toolkit
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 3
Asynchronous JavaScript And Xml
A technique (not a specific technology)
A client-side approach and server agnostic
Makes web application highly interactive
Server round-trip without page refresh
Supported by most modern browsers
Internet Explorer 5.0, Mozilla 1.0, Safari 1.2 and above
AJAX Success Stories
Google, Amazon, Windows Live Mail, Gmail, Netflix
Improve User Experience
Asynchronous tasks
Minimize page refresh
Rich interaction
Easy to Develop
JavaScript
DOM (HTML + XML)
Browser Compatibility
Network
Dependency
Complex
To Develop
Broad
Reach
Easy Change
Management
Ease of
Deployment
Poor User
Experience
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 4
Client-side approach using JavaScript
XmlHttpRequest (XHR) Object
HTML Document Object Model
XML Document Object Model
Server-side
Code
Callback
XHR
Event
Page
ServerClient
12
3
4
5
6
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 5
What is ASP.NET AJAX?
High Productivity AJAX Development Framework
Fewer concepts, fewer lines of code
Application and UI building blocks for common scenarios
Builds on Top of ASP.NET 2.0
Easy to Author, Debug, and Maintain
Clean separation of content, style, behavior, and code
Well integrated with design and development tools
Seamlessly integrated application model
Works with ASP.NET pages and server controls
Allows access to ASP.NET web services and components
ASP.NET AJAX Architecture
ASP.NET AJAX Client Framework & Services
ASP.NET AJAX
-enabled
ASP.NET Pages
Web Services(ASMX or WCF)
HTML, Script,
ASP.NET AJAX
Markup
ASP.NET AJAX
Service
Proxies
ASP.NET AJAX Server Framework
ASP.NET 2.0
Application
Services
Page
Framework,
Server Controls
ASP.NET AJAX Server Extensions
ASP.NET AJAX
Server Controls
App Services
Bridge
Web Services
Bridge
Microsoft AJAX Library
(Client Script Library)
Controls, Components
Script Core
Base Class Library
Component Model and
UI Framework
Browser Compatibility
ASP.NET AJAX
Client App
Services
Local Store
Browser
Integration
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 6
ASP.NET AJAX Scenarios
Server-centric Ajax Web Development
Incremental Ajax approach to add UI enrichment
Enrich Applications without lots of Javascript Code
Keep core UI/Application logic on server (VB/C#)
Client-centric Ajax Web Development
Leverage full power of script/DHTML
Provide richer and more interactive user experience
Build mash-ups, gadgets and other new immersive experiences
UpdatePanel
Update-
Progress
Timer
ScriptManager
ScriptManager-
Proxy
Script
Management
Partial-Page
Rendering
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 7
Must have one ScriptManager instance!
What does ScriptManager do?
Downloads JavaScript files to client
Enables partial-page rendering using UpdatePanel
Provides access to Web services via client-side proxies
Manages callback timeouts and provides error handling options and infrastructure
Provides registration methods for scripts
Enables ASP.NET AJAX localization support
ScriptManagerProxy proxies ScriptManagerdeclared in master page
Partial-page rendering in a box
Clean round trips to server and flicker-free updates
Requires no knowledge of JavaScript or AJAX
Leverages client-side PageRequestManager class
EnablePartialRendering="true" in ScriptManager
Supports explicitly defined triggers
By default, postbacks from all controls in an UpdatePanel are converted into async callbacks
Triggers expand (or shrink) postback->callback scope
Works in virtually all scenarios
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 8
PostBackTrigger
Allows controls inside an UpdatePanel to post back
Typically used to allow certain controls to post back when ChildrenAsTriggers=“true” (true by default)
AsyncPostBackTrigger
Converts postbacks into asynchronous callbacks
Typically used to trigger updates when controls outside an UpdatePanel post back and fire events
If ChildrenAsTriggers=“false”, can be used to specify which controls inside UpdatePanel should call back rather than post back
Combine UpdatePanel with Timer control to implement pages that perform periodic updates
Use Timer control Tick events as triggers
<asp:Timer ID="Timer1" Runat="server" Interval="5000"
OnTick="OnTimerTick" />
...
<asp:UpdatePanel UpdateMode="Conditional" ...>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" />
</Triggers>
...
</asp:UpdatePanel>
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 9
Companion to UpdatePanel controls
Displays custom template-driven UI for:
Indicating that an async update is in progress
Canceling an async update that is in progress
Automatically displayed when update begins or "DisplayAfter" interval elapses
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 10
ASP.NET AJAX supports ASMX Web methods as endpoints for asynchronous AJAX callbacks
Efficient on the wire (no SOAP or XML)
Efficient on the server (no page lifecycle)
ScriptService attribute on server indicates Web service is callable from client-side script
JavaScript proxy on client enables JavaScript clients to call Web methods on server
Proxies generated by service references
WCF support is available in Orcas!
[System.Web.Script.Services.ScriptService]
public class ZipCodeService : System.Web.Services.WebService
{
[System.Web.Services.WebMethod]
public string[] GetCityAndState (string zip)
{
...
}
}
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 11
<asp:ScriptManager ID="ScriptManager1" Runat="server">
<Services>
<asp:ServiceReference Path="ZipCodeService.asmx" />
</Services>
</asp:ScriptManager>
<script src="ZipCodeService.asmx/js" type="text/javascript">
</script>
ZipCodeService.GetCityAndState("98052", onCompleted);
.
.
.
function onCompleted (result)
{
window.alert(result);
}
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 12
ZipCodeService.GetCityAndState("98052", onCompleted, onFailed);
.
.
.
function onCompleted (result, context, methodName)
{
window.alert(result);
}
function onFailed (err, context, methodName)
{
window.alert(err.get_message());
}
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 13
Script-callable Web methods built into pages
Implemented in ASPXes, not ASMXes
Same efficiencies as ASMX Web methods
Simpler than writing a full-blown Web service
Do not require service references
Do not require dedicated ASMX files
Must be public static methods
Must be enabled via ScriptManager.-EnablePageMethods (disabled by default)
Called through PageMethods proxy on client
<asp:ScriptManager ID=“MyScriptManager" EnablePageMethods="true"
Runat="server" />
var PageMethods = function() {
PageMethods.initializeBase(this);
this._timeout = 0;
this._userContext = null;
this._succeeded = null;
this._failed = null;
}
PageMethods.prototype = {
...
}
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 14
public partial class MyPage : System.Web.UI.Page
{
[System.Web.Services.WebMethod]
public static string[] GetProducts (int CatID)
{
...
}
...
}
PageMethods.GetProducts(1, onCompleted);
.
.
.
function onCompleted(result)
{
window.alert(result);
}
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 15
Some ASP.NET application services are accessible from client
JavaScript proxies enable client to consume server-side service asynchronously
AuthenticationService, RoleService, and ProfileService
Must be enabled in web.config to access the client-side proxies
Other settings specific to application services must be configured
Authorization rules
Profile properties
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 16
ASP.NET AJAX Control Toolkit
Download from
Build project "AjaxControlToolkit"
To use provided Extender Controls
Add Controls to Visual Studio Toolbox
~\bin\[target]\AjaxControlToolkit.dll
To create your own Extender Controls
Install Project Templates
AjaxControlExtender.vsi
Read Documentation & Walkthroughs
http://ajax.asp.net/ajaxtoolkit/
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 17
It is all about providing rich experience
Almost all applications can benefits from AJAX
Input Validation
Populate form data (without post-backs)
Apply AJAX judiciously
Usability must be considered
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 18
You may configure page EnableEventValidationproperty to false
Can be defined in <% Page %> or web.config
Post-back to cross-domain resources may not be allowed
XmlHttpRequest is subjected to browser security “sandbox”
Restriction depends on browser settings
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 19
ASP.NET AJAX Official Site
http://asp.net/ajax/
ASP.NET AJAX Virtual Labs
http://msdn2.microsoft.com/en-us/virtuallabs/aa740364.aspx
ASP.NET AJAX Community Blogs
http://weblogs.asp.net/communityblogs/archive/tags/ASP.NET+Ajax/default.aspx
ASP.NET AJAX Online Documentation
http://asp.net/ajax/documentation/live/
ASP.NET AJAX Control Toolkit
http://www.codeplex.com/Wiki/View.aspx?ProjectName=AtlasControlToolkit
Mark YOUR Success with Microsoft Certified Professionals
Visit the
Microsoft Learning PavilionIn Exhibition Hall
LEARN
Stay competitive. Get trained. Get
hands on with our Official Microsoft
Learning Products and discover lots of great deals – ONLY
AT Tech•Ed!
MEET
Come & talk to our Microsoft Certified
Professionals, Certified Trainers, and our Microsoft CPLS (Certified
Partner for Learning Solution) to identify
your learning roadmap to success!
EXPERIENCE
Register yourself for a FREE Microsoft pre-test session to help identify your
areas of improvements
before sitting for an actual Microsoft
Professional exam!
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 20
Download presentation slides
Presentation slides will be
available for download at the
Tech•Ed Internet Café or after
the event at:
www.microsoft.com/malaysia/events
Did you like this session?
Please complete the track
evaluation form and return it to the
track managers on your way out…
You may be a lucky winner of some
cool prizes!
9/22/2007
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it
should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION. 21
We value your feedback!
Please remember to complete the
overall conference evaluation form
(in your bag) and return it to the
Handout Counter on the last day
© 2007 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.