SlideShare ist ein Scribd-Unternehmen logo
1 von 43
 
The ASP.NET AJAX Extensions Jeff Prosise Cofounder, Wintellect www.wintellect.com
Architecture ASP.NET 2.0 Page Framework & Server Controls Application Services ASP.NET AJAX Extensions Server Controls ASPX ASMX Application Services Bridge Asynchronous Communications
Server Controls UpdatePanel Update- Progress Timer DragOverlay- Extender ScriptManager ScriptManager- Proxy ProfileService Script Management Partial-Page Rendering Futures CTP
ScriptManager ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ScriptManager Schema <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot; EnablePartialRendering=&quot;true|false&quot; EnablePageMethods=&quot;true|false&quot; AsyncPostBackTimeout=&quot; seconds &quot; AsyncPostBackErrorMessage=&quot; message &quot; AllowCustomErrorsRedirect=&quot;true|false&quot; OnAsyncPostBackError=&quot; handler &quot; EnableScriptGlobalization=&quot;true|false&quot; EnableScriptLocalization=&quot;true|false&quot; ScriptMode=&quot;Auto|Inherit|Debug|Release&quot; ScriptPath=&quot; path &quot;> <Scripts> <!-- Declare script references here --> </Scripts> <Services> <!-- Declare Web service references here --> </Services> </asp:ScriptManager>
Script References <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot;> <Scripts> <asp:ScriptReference Name=&quot;PreviewScript.js&quot; Assembly=&quot;Microsoft.Web.Preview&quot; /> <asp:ScriptReference Name=&quot;PreviewDragDrop.js&quot; Assembly=&quot;Microsoft.Web.Preview&quot; /> <asp:ScriptReference Path=&quot;~/Scripts/UIMap.js&quot; /> </Scripts> </asp:ScriptManager> &quot;Path&quot; references load script files &quot;Name&quot; references load script resources
Service References <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot;> <Services> <asp:ServiceReference Path=&quot;ZipCodeService.asmx&quot; /> </Services> </asp:ScriptManager>
ScriptManagerProxy ,[object Object],[object Object],<asp:ScriptManagerProxy ID=&quot;ScriptManagerProxy1&quot; Runat=&quot;server&quot;> <Scripts> <!-- Declare additional script references here --> </Scripts> <Services> <!-- Declare additional service references here --> </Services> </asp:ScriptManagerProxy>
UpdatePanel ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
UpdatePanel Schema <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot; EnablePartialRendering=&quot;true&quot; /> . . . <asp:UpdatePanel ID=&quot;UpdatePanel1&quot; Runat=&quot;server&quot; UpdateMode=&quot;Always|Conditional&quot; ChildrenAsTriggers=&quot;true|false&quot;> <Triggers> <!-- Define triggers (if any) here --> </Triggers> <ContentTemplate> <!-- Define content here --> </ContentTemplate> </asp:UpdatePanel>
Triggers ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Triggers Example <asp:UpdatePanel ID=&quot;UpdatePanel1&quot; Runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot;> <Triggers> <asp:AsyncPostBackTrigger ControlID=&quot;Button1&quot; /> <asp:AsyncPostBackTrigger ControlID=&quot;TreeView1&quot; EventName=&quot;TreeNodeExpanded&quot; /> <asp:AsyncPostBackTrigger ControlID=&quot;TreeView1&quot; EventName=&quot;TreeNodeCollapsed&quot; /> <asp:PostBackTrigger ControlID=&quot;Button2&quot; /> </Triggers> <ContentTemplate> ... </ContentTemplate> </asp:UpdatePanel>
Periodic Updates ,[object Object],[object Object],<asp:Timer ID=&quot;Timer1&quot; Runat=&quot;server&quot; Interval=&quot;5000&quot; OnTick=&quot;OnTimerTick&quot; /> ... <asp:UpdatePanel UpdateMode=&quot;Conditional&quot; ...> <Triggers> <asp:AsyncPostBackTrigger ControlID=&quot;Timer1&quot; /> </Triggers> ... </asp:UpdatePanel>
Demo
UpdateProgress ,[object Object],[object Object],[object Object],[object Object],[object Object]
UpdateProgress Schema <asp:UpdateProgress ID=&quot;UpdateProgress1&quot; Runat=&quot;server&quot; DisplayAfter=&quot; milliseconds &quot; DynamicLayout=&quot;true|false&quot; AssociatedUpdatePanelID=&quot; UpdatePanelID &quot;> <ProgressTemplate> <!-- Declare UpdateProgress UI here --> </ProgressTemplate> </asp:UpdateProgress>
UpdateProgress Example <asp:UpdateProgress DisplayAfter=&quot;500&quot; ...> <ProgressTemplate> <asp:Image ID=&quot;ProgressImage&quot; Runat=&quot;server&quot; ImageUrl=&quot;~/Images/SpinningClock.gif&quot; /> </ProgressTemplate> </asp:UpdateProgress> Animated GIF Display after ½ second
Canceling an Update <asp:UpdateProgress DisplayAfter=&quot;500&quot; ...> <ProgressTemplate> <b>Working...</b> <asp:Button ID=&quot;CancelButton&quot; Runat=&quot;server&quot; Text=&quot;Cancel&quot; OnClientClick=&quot;cancelUpdate(); return false&quot; /> </ProgressTemplate> </asp:UpdateProgress> <script type=&quot;text/javascript&quot;> function cancelUpdate() { var obj = Sys.WebForms.PageRequestManager.getInstance(); if (obj.get_isInAsyncPostBack()) obj.abortPostBack(); } </script>
Demo
ASP.NET AJAX Web Services ,[object Object],[object Object],[object Object],[object Object],[object Object]
Script-Callable Web Service [System.Web.Script.Services.ScriptService] public class ZipCodeService : System.Web.Services.WebService { [System.Web.Services.WebMethod] public string[] GetCityAndState (string zip) { ... } }
Declaring a Service Reference <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot;> <Services> <asp:ServiceReference Path=&quot;ZipCodeService.asmx&quot; /> </Services> </asp:ScriptManager> <script src=&quot;ZipCodeService.asmx/js&quot; type=&quot;text/javascript&quot;> </script>
Consuming a Web Service ZipCodeService.GetCityAndState(&quot;98052&quot;, onCompleted); . . . function onCompleted (result) { window.alert(result); }
Handling Errors ZipCodeService.GetCityAndState(&quot;98052&quot;, onCompleted, onFailed); . . . function onCompleted (result, context, methodName) { window.alert(result); } function onFailed (err, context, methodName) { window.alert(err.get_message()); }
Demo
ASMX Wire Format POST /AtlasRC/ZipCodeService.asmx/GetCityAndState HTTP/1.1 Accept: */* Accept-Language: en-us Referer: http://localhost:1997/AtlasRC/ZipCodePage.aspx UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; ...) Host: localhost:1997 Content-Length: 15 Connection: Keep-Alive Cache-Control: no-cache {&quot;zip&quot;:&quot;98052&quot;} Request HTTP/1.1 200 OK Server: ASP.NET Development Server/8.0.0.0 Date: Fri, 29 Dec 2006 21:06:17 GMT X-AspNet-Version: 2.0.50727 Cache-Control: private, max-age=0 Content-Type: application/json; charset=utf-8 Content-Length: 16 Connection: Close [&quot;REDMOND&quot;,&quot;WA&quot;] Response JSON-encoded input JSON-encoded output
ScriptHandlerFactory ,[object Object],[object Object],[object Object],[object Object],<httpHandlers> <remove verb=&quot;*&quot; path=&quot;*.asmx&quot; /> <add verb=&quot;*&quot; path=&quot;*.asmx&quot; validate=&quot;false&quot; type=&quot;System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, ...&quot; /> </httpHandlers>
ASMX Request Handling ScriptHandler- Factory RestClient- ProxyHandler RestHandler WebService- HandlerFactory *.asmx &quot;Normal&quot; ASMX calls ASMX Extensions *.asmx/js *.asmx/ methodname Helper Classes Default ASMX handler
JSON ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
JSON vs. XML Point p = new Point(100, 200); {&quot;IsEmpty&quot;:false,&quot;X&quot;:100,&quot;Y&quot;:200} JSON <?xml version=&quot;1.0&quot;?> <Point xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;> <X>100</X> <Y>200</Y> </Point> XML
The ScriptMethod Attribute ,[object Object],[object Object],Property Description UseHttpGet True = Use HTTP GET, False = Use HTTP POST (default) ResponseFormat ResponseFormat.Xml or ResponseFormat.Json (default) XmlSerializeString True = Serialize everything (including strings) as XML, False = Serialize response strings as JSON (default) (Only valid if ResponseFormat == ResponseFormat.Xml)
Using ScriptMethod [System.Web.Script.Services.ScriptService] public class ZipCodeService : System.Web.Services.WebService { [System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod (ResponseFormat=ResponseFormat.Xml)] public XmlDocument GetCityAndState (string zip) { ... } } Method returns XML document, so serialize as XML rather than JSON
Page Methods ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Enabling Page Methods <asp:ScriptManager ID=&quot;ScriptManager1&quot; EnablePageMethods=&quot;true&quot; Runat=&quot;server&quot; /> var PageMethods = function() { PageMethods.initializeBase(this); this._timeout = 0; this._userContext = null; this._succeeded = null; this._failed = null; } PageMethods.prototype = { ... }
Defining a Page Method public partial class MyPage : System.Web.UI.Page { [System.Web.Services.WebMethod] public static string[] GetCityAndState (string zip) { ... } ... }
Calling a Page Method PageMethods.GetCityAndState(&quot;98052&quot;, onComplete); . . . function onComplete(result) { window.alert(result); }
Demo
Built-In Web Services ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Using AuthenticationService Sys.Services.AuthenticationService.login (username, password, false, null, null, onLoginCompleted, onLoginFailed); ... function onLoginCompleted(result, context, methodName) { window.alert(result ? 'Login succeeded' : 'Login failed'); } function onLoginFailed(err, context, methodName) { window.alert(err.get_message()); }
Loading Profile Properties Sys.Services.ProfileService.load(['ScreenName'], onLoadCompleted, onLoadFailed); ... function onLoadCompleted(result, context, methodName) { window.alert(Sys.Services.ProfileService.properties.ScreenName); } function onLoadFailed(err, context, methodName) { window.alert(err.get_message()); } Pass null to load all profile properties
Saving Profile Properties Sys.Services.ProfileService.properties.ScreenName = 'Bob'; Sys.Services.ProfileService.save(['ScreenName'], onSaveCompleted, onSaveFailed); ... function onSaveCompleted(result, context, methodName) { window.alert('Save succeeded'); } function onSaveFailed(err, context, methodName) { window.alert(err.get_message()); } Pass null to save all profile properties
 

Weitere ähnliche Inhalte

Was ist angesagt?

Services Apps Iand Flex Applications
Services Apps Iand Flex ApplicationsServices Apps Iand Flex Applications
Services Apps Iand Flex ApplicationsSumit Kataria
 
AngularJS Unit Testing
AngularJS Unit TestingAngularJS Unit Testing
AngularJS Unit TestingPrince Norin
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Frost
 
Einführung in Angular 2
Einführung in Angular 2Einführung in Angular 2
Einführung in Angular 2Johannes Hoppe
 
It’s your time to ask questions
It’s your time to ask questionsIt’s your time to ask questions
It’s your time to ask questionsGil Sheps
 
The ten commandments for an Agile Developer
The ten commandments for an Agile DeveloperThe ten commandments for an Agile Developer
The ten commandments for an Agile DeveloperSowmya Karmali
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit TestChiew Carol
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScriptYakov Fain
 
Testing Ember Apps: Managing Dependency
Testing Ember Apps: Managing DependencyTesting Ember Apps: Managing Dependency
Testing Ember Apps: Managing DependencyMatthew Beale
 
Introduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioIntroduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioPaul Knittel
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introductionNir Kaufman
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoNyros Technologies
 
Apache Camel
Apache CamelApache Camel
Apache Camelhelggeist
 
appserver.io tutorial
appserver.io tutorialappserver.io tutorial
appserver.io tutorialappserver.io
 

Was ist angesagt? (20)

Services Apps Iand Flex Applications
Services Apps Iand Flex ApplicationsServices Apps Iand Flex Applications
Services Apps Iand Flex Applications
 
Palestra VCR
Palestra VCRPalestra VCR
Palestra VCR
 
AngularJS Unit Testing
AngularJS Unit TestingAngularJS Unit Testing
AngularJS Unit Testing
 
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
Building an angular application -1 ( API: Golang, Database: Postgres) v1.0
 
Karma - JS Test Runner
Karma - JS Test RunnerKarma - JS Test Runner
Karma - JS Test Runner
 
Gearman and Perl
Gearman and PerlGearman and Perl
Gearman and Perl
 
Einführung in Angular 2
Einführung in Angular 2Einführung in Angular 2
Einführung in Angular 2
 
Ugo Cei Presentation
Ugo Cei PresentationUgo Cei Presentation
Ugo Cei Presentation
 
It’s your time to ask questions
It’s your time to ask questionsIt’s your time to ask questions
It’s your time to ask questions
 
Rare frontend testing
Rare frontend testingRare frontend testing
Rare frontend testing
 
The ten commandments for an Agile Developer
The ten commandments for an Agile DeveloperThe ten commandments for an Agile Developer
The ten commandments for an Agile Developer
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Vuejs testing
Vuejs testingVuejs testing
Vuejs testing
 
Testing Ember Apps: Managing Dependency
Testing Ember Apps: Managing DependencyTesting Ember Apps: Managing Dependency
Testing Ember Apps: Managing Dependency
 
Introduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.ioIntroduction to Ember.js and how we used it at FlowPro.io
Introduction to Ember.js and how we used it at FlowPro.io
 
Angularjs - Unit testing introduction
Angularjs - Unit testing introductionAngularjs - Unit testing introduction
Angularjs - Unit testing introduction
 
Deploying Rails Apps with Capistrano
Deploying Rails Apps with CapistranoDeploying Rails Apps with Capistrano
Deploying Rails Apps with Capistrano
 
Apache Camel
Apache CamelApache Camel
Apache Camel
 
appserver.io tutorial
appserver.io tutorialappserver.io tutorial
appserver.io tutorial
 

Ähnlich wie ASP.NET AJAX Extensions Overview

AJAX ASP.Net
AJAX ASP.NetAJAX ASP.Net
AJAX ASP.NetSHC
 
Esposito Ajax Remote
Esposito Ajax RemoteEsposito Ajax Remote
Esposito Ajax Remoteask bills
 
Introduction To Asp.Net Ajax
Introduction To Asp.Net AjaxIntroduction To Asp.Net Ajax
Introduction To Asp.Net AjaxJeff Blankenburg
 
Aspnet2 Overview
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overviewajitbergi
 
ASP.NET AJAX Basics
ASP.NET AJAX BasicsASP.NET AJAX Basics
ASP.NET AJAX Basicspetrov
 
A Web Developer's Journey across different versions of ASP.NET
A Web Developer's Journey across different versions of ASP.NETA Web Developer's Journey across different versions of ASP.NET
A Web Developer's Journey across different versions of ASP.NETHarish Ranganathan
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauSpiffy
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验yiditushe
 
SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSteve Souders
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NETPeter Gfader
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component BehaviorsAndy Schwartz
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSCarol McDonald
 
Building scalable rest service using Akka HTTP
Building scalable rest service using Akka HTTPBuilding scalable rest service using Akka HTTP
Building scalable rest service using Akka HTTPdatamantra
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentChui-Wen Chiu
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19Vivek chan
 

Ähnlich wie ASP.NET AJAX Extensions Overview (20)

AJAX ASP.Net
AJAX ASP.NetAJAX ASP.Net
AJAX ASP.Net
 
Esposito Ajax Remote
Esposito Ajax RemoteEsposito Ajax Remote
Esposito Ajax Remote
 
ASP.NET MVC
ASP.NET MVCASP.NET MVC
ASP.NET MVC
 
Introduction To Asp.Net Ajax
Introduction To Asp.Net AjaxIntroduction To Asp.Net Ajax
Introduction To Asp.Net Ajax
 
Aspnet2 Overview
Aspnet2 OverviewAspnet2 Overview
Aspnet2 Overview
 
Ajax
AjaxAjax
Ajax
 
ASP.NET AJAX Basics
ASP.NET AJAX BasicsASP.NET AJAX Basics
ASP.NET AJAX Basics
 
A Web Developer's Journey across different versions of ASP.NET
A Web Developer's Journey across different versions of ASP.NETA Web Developer's Journey across different versions of ASP.NET
A Web Developer's Journey across different versions of ASP.NET
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
mukesh
mukeshmukesh
mukesh
 
ASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin LauASP.NET Overview - Alvin Lau
ASP.NET Overview - Alvin Lau
 
Google在Web前端方面的经验
Google在Web前端方面的经验Google在Web前端方面的经验
Google在Web前端方面的经验
 
Sxsw 20090314
Sxsw 20090314Sxsw 20090314
Sxsw 20090314
 
SXSW: Even Faster Web Sites
SXSW: Even Faster Web SitesSXSW: Even Faster Web Sites
SXSW: Even Faster Web Sites
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
JSF Component Behaviors
JSF Component BehaviorsJSF Component Behaviors
JSF Component Behaviors
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 
Building scalable rest service using Akka HTTP
Building scalable rest service using Akka HTTPBuilding scalable rest service using Akka HTTP
Building scalable rest service using Akka HTTP
 
Asp.Net Ajax Component Development
Asp.Net Ajax Component DevelopmentAsp.Net Ajax Component Development
Asp.Net Ajax Component Development
 
13 asp.net session19
13 asp.net session1913 asp.net session19
13 asp.net session19
 

Kürzlich hochgeladen

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Kürzlich hochgeladen (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

ASP.NET AJAX Extensions Overview

  • 1.  
  • 2. The ASP.NET AJAX Extensions Jeff Prosise Cofounder, Wintellect www.wintellect.com
  • 3. Architecture ASP.NET 2.0 Page Framework & Server Controls Application Services ASP.NET AJAX Extensions Server Controls ASPX ASMX Application Services Bridge Asynchronous Communications
  • 4. Server Controls UpdatePanel Update- Progress Timer DragOverlay- Extender ScriptManager ScriptManager- Proxy ProfileService Script Management Partial-Page Rendering Futures CTP
  • 5.
  • 6. ScriptManager Schema <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot; EnablePartialRendering=&quot;true|false&quot; EnablePageMethods=&quot;true|false&quot; AsyncPostBackTimeout=&quot; seconds &quot; AsyncPostBackErrorMessage=&quot; message &quot; AllowCustomErrorsRedirect=&quot;true|false&quot; OnAsyncPostBackError=&quot; handler &quot; EnableScriptGlobalization=&quot;true|false&quot; EnableScriptLocalization=&quot;true|false&quot; ScriptMode=&quot;Auto|Inherit|Debug|Release&quot; ScriptPath=&quot; path &quot;> <Scripts> <!-- Declare script references here --> </Scripts> <Services> <!-- Declare Web service references here --> </Services> </asp:ScriptManager>
  • 7. Script References <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot;> <Scripts> <asp:ScriptReference Name=&quot;PreviewScript.js&quot; Assembly=&quot;Microsoft.Web.Preview&quot; /> <asp:ScriptReference Name=&quot;PreviewDragDrop.js&quot; Assembly=&quot;Microsoft.Web.Preview&quot; /> <asp:ScriptReference Path=&quot;~/Scripts/UIMap.js&quot; /> </Scripts> </asp:ScriptManager> &quot;Path&quot; references load script files &quot;Name&quot; references load script resources
  • 8. Service References <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot;> <Services> <asp:ServiceReference Path=&quot;ZipCodeService.asmx&quot; /> </Services> </asp:ScriptManager>
  • 9.
  • 10.
  • 11. UpdatePanel Schema <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot; EnablePartialRendering=&quot;true&quot; /> . . . <asp:UpdatePanel ID=&quot;UpdatePanel1&quot; Runat=&quot;server&quot; UpdateMode=&quot;Always|Conditional&quot; ChildrenAsTriggers=&quot;true|false&quot;> <Triggers> <!-- Define triggers (if any) here --> </Triggers> <ContentTemplate> <!-- Define content here --> </ContentTemplate> </asp:UpdatePanel>
  • 12.
  • 13. Triggers Example <asp:UpdatePanel ID=&quot;UpdatePanel1&quot; Runat=&quot;server&quot; UpdateMode=&quot;Conditional&quot;> <Triggers> <asp:AsyncPostBackTrigger ControlID=&quot;Button1&quot; /> <asp:AsyncPostBackTrigger ControlID=&quot;TreeView1&quot; EventName=&quot;TreeNodeExpanded&quot; /> <asp:AsyncPostBackTrigger ControlID=&quot;TreeView1&quot; EventName=&quot;TreeNodeCollapsed&quot; /> <asp:PostBackTrigger ControlID=&quot;Button2&quot; /> </Triggers> <ContentTemplate> ... </ContentTemplate> </asp:UpdatePanel>
  • 14.
  • 15. Demo
  • 16.
  • 17. UpdateProgress Schema <asp:UpdateProgress ID=&quot;UpdateProgress1&quot; Runat=&quot;server&quot; DisplayAfter=&quot; milliseconds &quot; DynamicLayout=&quot;true|false&quot; AssociatedUpdatePanelID=&quot; UpdatePanelID &quot;> <ProgressTemplate> <!-- Declare UpdateProgress UI here --> </ProgressTemplate> </asp:UpdateProgress>
  • 18. UpdateProgress Example <asp:UpdateProgress DisplayAfter=&quot;500&quot; ...> <ProgressTemplate> <asp:Image ID=&quot;ProgressImage&quot; Runat=&quot;server&quot; ImageUrl=&quot;~/Images/SpinningClock.gif&quot; /> </ProgressTemplate> </asp:UpdateProgress> Animated GIF Display after ½ second
  • 19. Canceling an Update <asp:UpdateProgress DisplayAfter=&quot;500&quot; ...> <ProgressTemplate> <b>Working...</b> <asp:Button ID=&quot;CancelButton&quot; Runat=&quot;server&quot; Text=&quot;Cancel&quot; OnClientClick=&quot;cancelUpdate(); return false&quot; /> </ProgressTemplate> </asp:UpdateProgress> <script type=&quot;text/javascript&quot;> function cancelUpdate() { var obj = Sys.WebForms.PageRequestManager.getInstance(); if (obj.get_isInAsyncPostBack()) obj.abortPostBack(); } </script>
  • 20. Demo
  • 21.
  • 22. Script-Callable Web Service [System.Web.Script.Services.ScriptService] public class ZipCodeService : System.Web.Services.WebService { [System.Web.Services.WebMethod] public string[] GetCityAndState (string zip) { ... } }
  • 23. Declaring a Service Reference <asp:ScriptManager ID=&quot;ScriptManager1&quot; Runat=&quot;server&quot;> <Services> <asp:ServiceReference Path=&quot;ZipCodeService.asmx&quot; /> </Services> </asp:ScriptManager> <script src=&quot;ZipCodeService.asmx/js&quot; type=&quot;text/javascript&quot;> </script>
  • 24. Consuming a Web Service ZipCodeService.GetCityAndState(&quot;98052&quot;, onCompleted); . . . function onCompleted (result) { window.alert(result); }
  • 25. Handling Errors ZipCodeService.GetCityAndState(&quot;98052&quot;, onCompleted, onFailed); . . . function onCompleted (result, context, methodName) { window.alert(result); } function onFailed (err, context, methodName) { window.alert(err.get_message()); }
  • 26. Demo
  • 27. ASMX Wire Format POST /AtlasRC/ZipCodeService.asmx/GetCityAndState HTTP/1.1 Accept: */* Accept-Language: en-us Referer: http://localhost:1997/AtlasRC/ZipCodePage.aspx UA-CPU: x86 Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; ...) Host: localhost:1997 Content-Length: 15 Connection: Keep-Alive Cache-Control: no-cache {&quot;zip&quot;:&quot;98052&quot;} Request HTTP/1.1 200 OK Server: ASP.NET Development Server/8.0.0.0 Date: Fri, 29 Dec 2006 21:06:17 GMT X-AspNet-Version: 2.0.50727 Cache-Control: private, max-age=0 Content-Type: application/json; charset=utf-8 Content-Length: 16 Connection: Close [&quot;REDMOND&quot;,&quot;WA&quot;] Response JSON-encoded input JSON-encoded output
  • 28.
  • 29. ASMX Request Handling ScriptHandler- Factory RestClient- ProxyHandler RestHandler WebService- HandlerFactory *.asmx &quot;Normal&quot; ASMX calls ASMX Extensions *.asmx/js *.asmx/ methodname Helper Classes Default ASMX handler
  • 30.
  • 31. JSON vs. XML Point p = new Point(100, 200); {&quot;IsEmpty&quot;:false,&quot;X&quot;:100,&quot;Y&quot;:200} JSON <?xml version=&quot;1.0&quot;?> <Point xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot;> <X>100</X> <Y>200</Y> </Point> XML
  • 32.
  • 33. Using ScriptMethod [System.Web.Script.Services.ScriptService] public class ZipCodeService : System.Web.Services.WebService { [System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod (ResponseFormat=ResponseFormat.Xml)] public XmlDocument GetCityAndState (string zip) { ... } } Method returns XML document, so serialize as XML rather than JSON
  • 34.
  • 35. Enabling Page Methods <asp:ScriptManager ID=&quot;ScriptManager1&quot; EnablePageMethods=&quot;true&quot; Runat=&quot;server&quot; /> var PageMethods = function() { PageMethods.initializeBase(this); this._timeout = 0; this._userContext = null; this._succeeded = null; this._failed = null; } PageMethods.prototype = { ... }
  • 36. Defining a Page Method public partial class MyPage : System.Web.UI.Page { [System.Web.Services.WebMethod] public static string[] GetCityAndState (string zip) { ... } ... }
  • 37. Calling a Page Method PageMethods.GetCityAndState(&quot;98052&quot;, onComplete); . . . function onComplete(result) { window.alert(result); }
  • 38. Demo
  • 39.
  • 40. Using AuthenticationService Sys.Services.AuthenticationService.login (username, password, false, null, null, onLoginCompleted, onLoginFailed); ... function onLoginCompleted(result, context, methodName) { window.alert(result ? 'Login succeeded' : 'Login failed'); } function onLoginFailed(err, context, methodName) { window.alert(err.get_message()); }
  • 41. Loading Profile Properties Sys.Services.ProfileService.load(['ScreenName'], onLoadCompleted, onLoadFailed); ... function onLoadCompleted(result, context, methodName) { window.alert(Sys.Services.ProfileService.properties.ScreenName); } function onLoadFailed(err, context, methodName) { window.alert(err.get_message()); } Pass null to load all profile properties
  • 42. Saving Profile Properties Sys.Services.ProfileService.properties.ScreenName = 'Bob'; Sys.Services.ProfileService.save(['ScreenName'], onSaveCompleted, onSaveFailed); ... function onSaveCompleted(result, context, methodName) { window.alert('Save succeeded'); } function onSaveFailed(err, context, methodName) { window.alert(err.get_message()); } Pass null to save all profile properties
  • 43.  

Hinweis der Redaktion

  1. If no event name is specified in a trigger, the trigger automatically references the control&apos;s default event (e.g., Button.Click)
  2. One of the &amp;quot;Helper Classes&amp;quot; is WebServiceClientProxyGenerator , which RestClientProxyHandler calls upon to generate JavaScript proxies.
  3. ASP.NET AJAX’s JSON serializers provide special handling for one common .NET data type that isn’t handled natively by JSON: System.DateTime . Here’s how System.Web.Script.Serialization.JavaScriptSerializer serializes a date and time representing midnight on January 1, 2000 into JSON: &amp;quot;@946702800000@&amp;quot; The number between @ signs is the number of milliseconds elapsed since January 1, 1970. This is the format used by the ASP.NET AJAX Release Candidate (RC); it will probably be tweaked before RTM.
  4. The first null passed to the login function is used to pass custom data. The second null is a redirect URL. If a redirect URL is specified, the user is redirected to that location following a successful login. The third parameter to the login function specifies whether a logged-in user should be issued a temporary auth cookie (false) or a persistent auth cookie (true). In order for all this to work, the application&apos;s authentication mode must be set to &amp;quot;Forms.&amp;quot;