The Microsoft AJAX Library Jeff Prosise Cofounder, Wintellect

Slides:



Advertisements
Similar presentations
Module 1: Creating Responsive Pages with Ajax Creating Partial-Page Updates by Using AJAX Scripting Actions on the Web Client.
Advertisements

Softwaresponsoren Mediasponsoren. Jan Molnar Dennis Zielke
ASP.NET Ajax Supplementary Tutorial. Why Use ASP.NET AJAX? - I ASP.NET AJAX enables you to build rich Web applications that have many advantages over.
Current Popular IT I Pertemuan 4 Matakuliah: T0403/Current Popular IT I Tahun: 2008.
AJAX Development Mike Ormond Developer & Platform Group Microsoft Ltd
9. AJAX & RIA. 2 Motto: O! call back yesterday, bid time return. — William Shakespeare.
By Gyan Deo Singh Building Rich Web UI with the Microsoft AJAX Library, Extensions, and Toolkit.
Microsoft ASP.NET AJAX - AJAX as it has to be Presented by : Rana Vijayasimha Nalla CSCE Grad Student.
The Microsoft Technical Roadshow 2006 A Web-enabled Experience with Altas Mike Ormond Developer & Platform Evangelism Group, Microsoft Ltd
Simon Amrein Consultant Trivadis AG What is ASP.NET 4.0 Ajax Ajax Control Toolkit Microsoft Ajax Content Delivery Network jQuery jQuery Client Templates.
Chapter 6 DOJO TOOLKITS. Objectives Discuss XML DOM Discuss JSON Discuss Ajax Response in XML, HTML, JSON, and Other Data Type.
CST JavaScript Validating Form Data with JavaScript.
The Document Object Model (DOM) & Asynchronous Javascript And XML (AJAX) : an introduction UFCEKG-20-2 : Data, Schemas and Applications.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
NextGen Technology upgrade – Synerizip - Sandeep Kamble.
Ajax (Asynchronous JavaScript and XML). AJAX  Enable asynchronous communication between a web client and a server.  A client is not blocked when an.
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
A Scalable Application Architecture for composing News Portals on the Internet Serpil TOK, Zeki BAYRAM. Eastern MediterraneanUniversity Famagusta Famagusta.
JavaScript & jQuery the missing manual Chapter 11
XForms: A case study Rajiv Shivane & Pavitar Singh.
Inside the Microsoft AJAX Library - AJAX and JavaScript ( AJAX acronym: Asynchronous JavaScript and XML) - new object-oriented features - modified XMLHttpRequest.
CSCI 6962: Server-side Design and Programming Introduction to AJAX.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
Yahoo! User Interface (YUI) Library Natly Mekdara.
Introduce What is ASP.NET AJAX Architecture of ASP.NET AJAX
Building rich web applications with the ‘Atlas’ framework Mike Ormond Developer & Platform Evangelism Group, Microsoft Ltd Developer & Platform Evangelism.
ASP.NET AJAX 1. Ordinary web applications vs. AJAX Ordinary web application The full page is updated at each request The page is not available while being.
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Beginning Web Site Development Module 1 – Dynamic Web Site Development Fundamentals of building dynamic Web sites with ASP.NET 2.0 and C# Version.
Power ASP.NET AJAX Programming. Agenda Partial-page rendering –With UpdatePanel –Without UpdatePanel PageRequestManager Drag-and-drop user interfaces.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
ASP.NET Web Server Controls Basic Web Server Controls.
ASP.NET Controls. Slide 2 Lecture Overview Identify the types of controls supported by ASP.NET and the differences between them.
Web Applications meets Life Microsoft ASP.NET “Atlas” Saurabh Verma Chief Software Architect | The Perfect Future
Javascript II DOM & JSON. In an effort to create increasingly interactive experiences on the web, programmers wanted access to the functionality of browsers.
ASP.NET 2.0 : Future Directions Developing Rich Web Applications with “Atlas” 7 & 8 March 2006 ICC Gent Contact me :
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
VB and C# Programming Basics. Overview Basic operations String processing Date processing Control structures Functions and subroutines.
Ventsislav Popov Crossroad Ltd.. 1. What is AJAX?  AJAX Concept  ASP.NET AJAX Framework 2. ASP.NET AJAX Server Controls  ScriptManager, UpdatePanel.
1 Geospatial and Business Intelligence Jean-Sébastien Turcotte Executive VP San Francisco - April 2007 Streamlining web mapping applications.
Telerik Software Academy ASP.NET Web Forms Telerik Software Academy ASP.NET Web Forms.
Lecture 9: AJAX, Javascript review..  AJAX  Synchronous vs. asynchronous browsing.  Refreshing only “part of a page” from a URL.  Frameworks: Prototype,
PAGE DIRECTIVES. Page Directives  They are instructions, inserted at the top of an ASP.NET page, to control the behavior of ASP.NET pages.  So it is.
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
Asynchronous Javascript And XML AJAX : an introduction UFCEUS-20-2 : Web Programming.
ASP.NET 4 Unleashed Chapter 1. .aspx page: contains C# script and HTML code including tags. Listing 1.1 FirstPage.aspx.
Unleash the Power of jQuery Learning & Development Team Telerik Software Academy.
Chapter 16: Ajax-Enabled Rich Internet Applications with XML and JSON TP2543 Web Programming Mohammad Faidzul Nasrudin.
Building AJAX-Enabled Applications with ASP.NET AJAX Framework Peter Ty Developer Evangelist Microsoft Hong Kong
Understanding Web Applications Lesson 4. Objective Domain Matrix Skills/ConceptsMTA Exam Objectives Understanding Web Page Development Understand Web.
Rich Internet Applications 3. Client JavaScript. Document Object Model (DOM) The DOM, is an interface that allows scripts or programs to access and manipulate.
IT533 Lectures ASP.NET AJAX.
Asp.NET Core Server Controls. Slide 2 Lecture Overview Understanding the types of ASP.NET controls HTML controls ASP.NET (Web) controls.
CHAPTER 8 AJAX & JSON WHAT IS AJAX? Ajax lets you…
AJAX CS456 Fall Examples Where is AJAX used? Why do we care?
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
Name Title Microsoft Corporation
Sergey Sidorov PhD student, computer software chair Computer Science department.
AJAX. Objectives Understand and apply AJAX Using AJAX in DOJO library.
Ext JS - Direct Bridging The Gap A DMSBT Presentation By Timothy Chandler.
The Microsoft Technical Roadshow 2007 AJAX Development Mike Ormond Developer & Platform Group Microsoft Ltd
ASP.NET AJAX Fedorov Sergey, student of Computing Mathematic and Cybernetics faculty, software department, NNGU
Building rich web applications with ASP.NET AJAX Mike Ormond Developer & Platform Evangelism Group, Microsoft Ltd Developer & Platform Evangelism Group,
Optimizing and Extending ASP.NET AJAX Stefan Schackow Program Manager.
Shanku Niyogi PRS 312 Group Program Manager Microsoft Corporation
Computing with C# and the .NET Framework
ASP.NET AJAX – Basics Svetlin Nakov Telerik Corporation
Working with Client-Side Scripting
Shanku Niyogi PRS 312 Group Program Manager Microsoft Corporation
Jim Fawcett CSE686 – Internet Programming Summer 2008
Presentation transcript:

The Microsoft AJAX Library Jeff Prosise Cofounder, Wintellect

Microsoft AJAX Library Architecture Browsers (IE, Firefox, Safari, others) Browser Compatibility Asynchronous Communications Script Core Library Base Class Library XHTML/CSSServer Scripts JSON Serializer JSON Serializer Web Service Proxies Web Service Proxies XML-HTTP Stack XML-HTTP Stack

JavaScript Framework Microsoft AJAX Library is a JavaScript framework –Global functions ($ functions) –JavaScript base type extensions –JavaScript type system –Core classes, interfaces, and other types (script core) –More classes, interfaces, and other types (BCL) JavaScript framework adds value to JavaScript –Adds OOP to JavaScript –Makes JavaScript an easier and more productive environment in which to work

Global Functions Helper functions for use anywhere, anytime Used in JavaScript emitted by server controls FunctionDescription $createCreates and initializes a component $findRetrieves the component with the specified ID $getRetrieves the DOM element with the specified ID $addHandler(s)Registers handlers for DOM event(s) $removeHandlerUnregisters a handler for a DOM event $clearHandlersUnregisters handlers for DOM events

$get and $create You write this: <asp:DragOverlayExtender ID="DragOverlayExtender1" TargetControlID="Target" Enabled="true" Runat="server" /> DragOverlayExtender emits this: $create(Sys.Preview.UI.FloatingBehavior, {"handle":$get('Target')}, null, null, $get('Target')); $create(Sys.Preview.UI.FloatingBehavior, {"handle":$get('Target')}, null, null, $get('Target'));

JavaScript Base Type Extensions Microsoft AJAX Library extends the following JavaScript types by adding new functions –Array - add, addRange, contains, insert, remove, etc. –Boolean - parse –Date - format, parselocale, parseInvariant, parse –Error - argumentOutOfRange, invalidOperation, etc. –Number - format, parseLocale, parseInvariant –Object - getType, getTypeName –String - format, endsWith, startWith, trim, etc. See Global/JavascriptTypeExtensions/default.aspx

String.Format var s = String.format ('{0}, {1}, and {2}', 1, 2, 3); window.alert (s);

Adding OOP to JavaScript JavaScript is object-based but not object-oriented Microsoft AJAX Library adds OOP to JavaScript –Namespaces –Classes –Inheritance –Interfaces –Enumerated types prototype property forms basis for "classes" Type class provides typing and type reflection

JavaScript "Classes" Person = function(name) { this._name = name; } Person.prototype = { get_name: function() { return this._name; } // Declare other class methods here }

Using the Person Class var p = new Person('Jeff'); // Displays "Jeff" window.alert(p.get_name());

Type Class Adds typing and type reflection to JavaScript Adds key instance methods to all types –registerClass, registerInterface –initializeBase, getBaseType –getBaseMethod, callBaseMethod, and others Implements key "static" type-related methods –registerNamespace –isNamespace, isClass, isInterface, and others Implemented in MicrosoftAjax.js

Registering Namespaces and Classes Type.registerNamespace('Wintellect'); Wintellect.Person = function(name) { this._name = name; } Wintellect.Person.prototype = { get_name: function() { return this._name; } Wintellect.Person.registerClass('Wintellect.Person');

Using Wintellect.Person var p = new Wintellect.Person('Jeff'); // Displays "Jeff" window.alert(p.get_name()); // Displays "Wintellect.Person" window.alert(Object.getTypeName(p));

Deriving from Wintellect.Person Wintellect.Programmer = function(name, language) { Wintellect.Programmer.initializeBase(this, [name]); this._language = language; } Wintellect.Programmer.prototype = { get_name: function() { var name = Wintellect.Programmer.callBaseMethod (this, 'get_name'); return name + ' (Programmer)'; }, get_language: function() { return this._language; } Wintellect.Programmer.registerClass ('Wintellect.Programmer', Wintellect.Person);

Using Wintellect.Programmer var p = new Wintellect.Programmer('Jeff', 'C#'); // Displays "Jeff (Programmer)" window.alert(p.get_name()); // Displays "C#" window.alert(p.get_language()); // Displays "Wintellect.Programmer" window.alert(Object.getTypeName(p));

MicrosoftAjax.js String- Builder String- Builder Sys WebRequest- Executor WebRequest- Executor Sys.Net _ProfileService Sys.Services JavaScript- Serializer JavaScript- Serializer Sys.Serialization DOMElement Sys.UI _Debug EventArgs Component _Application XMLHttp- EXecutor XMLHttp- EXecutor _WebRequest- Manager _WebRequest- Manager WebRequest WebService- Proxy WebService- Proxy WebService- Error WebService- Error Other ProfileGroup _Authentication- Service _Authentication- Service DOMEvent Behavior Control Point Bounds _Timer CultureInfo Other

StringBuilder var sb = new Sys.StringBuilder(); for (var i = 1; i <= 100; i++) { sb.append(i); // Count from 1 to 100 sb.append(' '); } var text = sb.toString(); // Get the results

_Debug Class Debugging class included in script core –"assert" method asserts that a condition is true –"fail" method breaks into the debugger –"trace" method writes trace output –"traceDump" dumps an object to trace output Global instance available through Sys.Debug // In MicrosoftAjax.js Sys.Debug = new Sys._Debug();

Using Sys.Debug // Assert var happy = false; Sys.Debug.assert(happy == true, 'happy is NOT true', false); // Break into the debugger Sys.Debug.fail('Somebody is NOT happy');

PreviewWebForms.js Partial-page rendering support –Sys.WebForms namespace PageRequestManager class –Client-side counterpart to UpdatePanel –Manages async callbacks used for partial-page rendering and performs content updates using results –Client-side OM enables advanced UpdatePanel customizations not possible from server side _UpdateProgress class

PageRequestManager Methods Provide programmatic control over client-side PageRequestManager MethodDescription get_isInAsyncPostBackIndicates whether async callback is in progress getInstanceReturns reference to current PageRequestManager instance abortPostBackCancel the async callback that is currently in progress add_*Registers handlers for PageRequestManager events remove_*Deregisters handlers for PageRequestManager events

PageRequestManager Events PageRequestManager fires client-side events Hook events on client for advanced customizations EventDescription initializeRequestFired before async callback commences beginRequestFired when async callback commences pageLoadingFired following an async callback (before content is updated) pageLoadedFired following a postback or callback (after content is updated) endRequestFired when async callback completes

Canceling Updates <asp:Button ID="CancelButton" Runat="server" Text="Cancel" OnClientClick="cancelUpdate(); return false" />. function cancelUpdate() { var obj = Sys.WebForms.PageRequestManager.getInstance(); if (obj.get_isInAsyncPostBack()) obj.abortPostBack(); }

PageRequestManager

PreviewScript.js BindingBase Sys.PreviewSys.Preview.UI DataControl Sys.Preview.Data DataColumn Sys.Preview.UI.Data ServiceMethod- Request ServiceMethod- Request Other Namespaces Binding Action InvokeMethod- Action InvokeMethod- Action SetProperty- Action SetProperty- Action Color Validator Label Button CheckBox DataNavigator ItemView Profile Timer Counter Other TextBox Selector Other ListView XSLTView Other DataRow DataTable DataView DataFilter DataSource Other

Sys.Preview.UI Classes that abstract HTML control elements –Button, Label, TextBox, Selector, etc. Base functionality defined in Sys.UI.Control –get_visible, set_visible –get_parent, set_parent –And so on Control classes simplify JavaScript and facilitate browser independence

Using Control Classes... var g_textBox; var g_label; function pageLoad() { g_textBox = new Sys.Preview.UI.TextBox($get('Input')); var button = new Sys.Preview.UI.Button($get('MyButton')); g_label = new Sys.Preview.UI.Label($get('Output')); button.initialize(); button.add_click(onClick); } function onClick() { g_label.set_text(g_textBox.get_text()); }

XML Script Alternative to imperative JavaScript –The "other way" to program the Microsoft AJAX Library Supporting infrastructure found in PreviewScript.js –XML parser translates declarations into actions

Using Control Classes (XML Script) <binding id="TextBinding" dataContext="Input" dataPath="text" property="text" automatic="false" />

Sys.Preview.[UI.].Data Contains classes that support rich client-side data binding ItemView and ListView do client-side rendering DataSource links data consumers to data service and supports 2-way data binding DataControl Sys.Preview.Data DataColumn Sys.Preview.UI.Data DataNavigator ItemView ListView XSLTView Other DataRow DataTable DataView DataFilter DataSource Other

ListView and DataSource...

Data Service [ScriptService] public class Books : DataService { [WebMethod] [DataObjectMethod(DataObjectMethodType.Select)] public Book[] GetTitles() { // TODO: Generate and return Book array } public class Book { private string _title; [DataObjectField(true)] public string Title { get { return _title; } set { _title = value; } }

Enabling Data Binding Register JSON converters in Web.config <add name="DataSetConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataSetConverter,..." /> <add name="DataRowConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataRowConverter,..." /> <add name="DataTableConverter" type="Microsoft.Web.Preview.Script.Serialization.Converters.DataTableConverter,..." />

Client-Side Data Binding

PreviewDragDrop.js Adds drag-drop support to BCL –Sys.Preview.UI namespace _DragDropManager provides core support –Global instance named DragDropManager IDropSource and IDropTarget interfaces define signatures for drop-source and drop-target classes DragDropList and DraggableListItem provide canned implementation of reorderable lists FloatingBehavior provides generic mechanism for floating images, DIVs, and other entities

Floating an Image... function pageLoad() { var float = new Sys.Preview.UI.FloatingBehavior ($get('FloatMe')); float.set_handle($get('FloatMe')); float.initialize(); }

Floating an Image (XML Script)...

Drag-and-Drop

PreviewGlitz.js Adds UI enhancements to BCL –Sys.Preview.UI.Effects namespace OpacityBehavior class wraps opacity of elements LayoutBehavior class wraps layout (size and pos) Animation and derivatives support animations Property- Animation Property- Animation Interpolated- Animation Interpolated- Animation Discrete- Animation Discrete- Animation Number- Animation Number- Animation Length- Animation Length- Animation Composite- Animation Composite- Animation Fade- Animation Fade- Animation

Fading In an Image... function pageLoad() { var image = new Sys.Preview.UI.Image ($get('SplashImage')); var fade = new Sys.Preview.UI.Effects.FadeAnimation(); fade.set_target(image); fade.set_effect (Sys.Preview.UI.Effects.FadeEffect.FadeIn); fade.set_duration(3); fade.set_fps(20); fade.play(); }

Fading In an Image (XML Script)... <fadeAnimation id="fade" target="SplashImage" effect="FadeIn" duration="3" fps="20" />

Discussion