Optimizing and Extending ASP.NET AJAX Stefan Schackow Program Manager.

Slides:



Advertisements
Similar presentations
Designing InfoPath Forms: The Dos and Donts Deploying InfoPath Forms: Making the right choice Adding custom business logicin case the built-in stuff isnt.
Advertisements

AJAX Development Mike Ormond Developer & Platform Group Microsoft Ltd
DEV392: Extending SharePoint Products And Technologies Through Web Parts And ASP.NET Clint Covington, Program Manager Data And Developer Services - Office.
By Gyan Deo Singh Building Rich Web UI with the Microsoft AJAX Library, Extensions, and Toolkit.
Simon Amrein Consultant Trivadis AG What is ASP.NET 4.0 Ajax Ajax Control Toolkit Microsoft Ajax Content Delivery Network jQuery jQuery Client Templates.
CLI319 Windows Vista Application Compatibility Tools and Resources Peg McNicol Product manager, Windows Client Chris Jackson Senior consultant and technical.
Report Management and Creation using Microsoft SQL Server 2008 Reporting Services Chris Testa-O’Neill Database Product Planner Remarc Group.
ASP.NET + Ajax Jesper Tørresø ITNET2 F08. Ajax Ajax (Asynchronous JavaScript and XML) A group of interrelated web development techniques used for creating.
Introduce What is ASP.NET AJAX Architecture of ASP.NET AJAX
The Microsoft AJAX Library Jeff Prosise Cofounder, Wintellect
Overview of Previous Lesson(s) Over View  ASP.NET Pages  Modular in nature and divided into the core sections  Page directives  Code Section  Page.
Power ASP.NET AJAX Programming. Agenda Partial-page rendering –With UpdatePanel –Without UpdatePanel PageRequestManager Drag-and-drop user interfaces.
Using the Actions Pane, Host Controls, and Smart Tags
AJAX and Atlas in ASP.NET 2.0 William J. Steele MSDN Developer Evangelist Microsoft Corporation
OFC335 Microsoft Office Word 2007 XML Programmability: True Data/View Separation and Rich Eventing for Custom XML Tristan Davis Program Manager Microsoft.
Web Applications meets Life Microsoft ASP.NET “Atlas” Saurabh Verma Chief Software Architect | The Perfect Future
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Ventsislav Popov Crossroad Ltd.. 1. What is AJAX?  AJAX Concept  ASP.NET AJAX Framework 2. ASP.NET AJAX Server Controls  ScriptManager, UpdatePanel.
Telerik Software Academy ASP.NET Web Forms Telerik Software Academy ASP.NET Web Forms.
WEB428 ASP.NET 2.0: Advanced Server Controls and Web Parts with ASP.NET 2.0 Andres Sanabria Program Manager Web Platform and Tools Team Microsoft Corporation.
J. Michael Palermo IV Director of Development Interface, USA WUX203.
Building AJAX-Enabled Applications with ASP.NET AJAX Framework Peter Ty Developer Evangelist Microsoft Hong Kong
Building Custom Controls with ASP.NET and the Microsoft ®.NET Framework Rames Gantanant Microsoft Regional Director, Thailand
05 | Integrating JavaScript and MVC 4 Jon Galloway | Tech Evangelist Christopher Harrison | Head Geek.
Dynamic Languages Initiative Silverlight ASP.NET Web Services Summary.
Design To Blend Dale G. Jones Director of Creative Design IdentityMine, Inc.
My Sessions here at Tech Ed Mon, 16:00, TLA201, Auditorium A Tour of Visual Studio 2008 and the.NET Framework 3.5 Tue, 10:45, MED202, Room 113 Building.
Name Title Microsoft Corporation
DAT316 Implementing Microsoft SQL Server Express Steve Lasker Program Manager Microsoft blogs.msdn.com/SteveLasker.
UCM305 Embedding Communications with UCMA SDK 1.0 Chris D. Mayo Technical Evangelist
Group Policy Preferences. Session Objectives And Agenda Group Policy Preferences High level Overview New Extensions details New Concepts Preferences Reporting.
BizTalk Damir Dobric Lead Architect. Agenda Microsoft BizTalk RFID Overview Architecture Application models Implementing Event Handlers Sensors.
Building Complete Web Application Using ASP.NET 3.5 & Visual Studio 2008 Omar Khan Group Program Manager Visual Studio.
TLA404 - MFC Updates for Visual Studio 2008 and Beyond Ale Contenti VC++ Libraries Dev Lead.
The Microsoft Technical Roadshow 2007 AJAX Development Mike Ormond Developer & Platform Group Microsoft Ltd
DES201 - Developers and Designers collaboration Level 200 Aude Mousset Artistic director i-Breed - France Dick Lantim User eXperience Advisor Microsoft.
ASP.NET AJAX Fedorov Sergey, student of Computing Mathematic and Cybernetics faculty, software department, NNGU
Using Data in Microsoft Visual Studio 2005 Tools for the Microsoft Office System Mike Hernandez Product Manager Visual Studio Tools for Office.
XSLT ‘Extreme’ TLA327 Dave McMahon MCAD,MCDBA,MVP – Connected Systems Developer.
Building Complete Web Application Using ASP.NET 3.5 & Visual Studio 2008 Omar Khan Group Program Manager Visual Studio.
Building rich web applications with ASP.NET AJAX Mike Ormond Developer & Platform Evangelism Group, Microsoft Ltd Developer & Platform Evangelism Group,
DAT303 - Entity Framework: Application Patterns Pablo Castro Technical Lead, Microsoft Corporation.
Reporting Services Futures: Report Authoring for Information Workers Ciprian Jichici Microsoft Regional Director for Romania General Manager, Genisoft.
Office 365 Development July 2014.
Shanku Niyogi PRS 312 Group Program Manager Microsoft Corporation
ASP.NET AJAX – Basics Svetlin Nakov Telerik Corporation
Working with Client-Side Scripting
Taking ASP.NET AJAX to the Next Level
Avalon – Using Data In Your Applications
7/29/2018 7:32 AM CSAX44 Finding Help When You Need It: Microsoft Dynamics® AX 2012 Documentation & Resources Margo Crandall Principal Technical Writer,
Shanku Niyogi PRS 312 Group Program Manager Microsoft Corporation
Microsoft Ajax Taking Ajax to the Next Level
Jim Fawcett CSE686 – Internet Programming Summer 2008
Excel Services Deployment and Administration
9/18/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
9/18/2018 © 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks.
Overview of Social Computing in Microsoft SharePoint 2010
Advanced Dashboard Creation Using Microsoft SharePoint Server 2010
Tech·Ed North America /28/ :50 AM
SharePoint & jQuery: Better Together
TechEd /9/2018 4:17 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
Tiberiu Covaci Senior Technical Trainer Many-core
Data Driven ASP.NET Web Forms Applications Deep Dive
Tech Ed North America /1/ :36 AM Required Slide
What's New in Visual Studio 2005
ASP.NET 4.0 State Management Improvements – Deep Dive
TechEd /18/ :08 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered.
Integrating with Windows 8 Experiences
Brandon Bray Principal Group Program Manager Microsoft Corporation
Tech Ed North America /6/2019 2:07 PM Required Slide
Presentation transcript:

Optimizing and Extending ASP.NET AJAX Stefan Schackow Program Manager

Optimizing UpdatePanel Customizing UpdatePanel Partial-page rendering without UpdatePanel ASP.NET AJAX type system and AJAX behaviors Drag-and-drop AJAX behavior Session Objectives And Agenda

UpdatePanel.UpdateMode UpdateMode controls when updates occur "Always" (default) "Conditional" Pages with multiple UpdatePanels should set UpdateMode="Conditional" on each UpdatePanel Call UpdatePanel.Update to update other UpdatePanels when one UpdatePanel updates Eliminates unnecessary rendering Less code executes on the server Less data comes back in the response

Selective updates with UpdatePanel

UpdatePanel on the Client Sys.WebForms.PageRequestManager 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 Prioritizing overlapping updates Canceling updates before they occur Canceling updates as they occur Highlighting updated UpdatePanels

PageRequestManager Methods MethodDescription get_isInAsyncPostBackIndicates whether async callback is in progress getInstance Returns reference to current PageRequestManager instance abortPostBack Cancels the async callback that is currently in progress add_* Registers handlers for PageRequestManager events remove_*Deregisters handlers for PageRequestManager events

PageRequestManager Events EventDescription initializeRequestFired during async callback initialization beginRequestFired just before async callback commences pageLoading Fired following an async callback (before content is updated) pageLoaded Fired following a postback or callback (after content is updated) endRequestFired when async callback completes

Canceling Asynchronous 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(); } <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(); }

Using PageRequestManager

Updates without UpdatePanels UpdatePanel trades ease-of-use for efficiency Request includes view state Page undergoes a nearly complete lifecycle Response size depends on size of UpdatePanel Partial-page rendering can be done without UpdatePanels Call back to Web method or page method on server Use JavaScript to update page (and Microsoft AJAX Library classes to maintain browser-independence) No view state + No lifecycle = Maximum efficiency

Updates without UpdatePanel

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 } 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('foo'); // Displays "foo" window.alert(p.get_name()); var p = new Person('foo'); // Displays "foo" 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('Contoso'); Contoso.Person = function(name) { this._name = name; } Contoso.Person.prototype = { get_name: function() { return this._name; } Contoso.Person.registerClass('Contoso.Person'); Type.registerNamespace('Contoso'); Contoso.Person = function(name) { this._name = name; } Contoso.Person.prototype = { get_name: function() { return this._name; } Contoso.Person.registerClass('Contoso.Person');

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

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

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

ASP.NET AJAX type System

Drag-and-Drop PreviewScript.js includes drag-drop types 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

Implementing IDragSource Custom.UI.MyDragSourceBehavior = function(element) { Custom.UI.MyDragSourceBehavior.initializeBase(this, [element]); this._mouseDownHandler = Function.createDelegate(this, this.mouseDownHandler);... } Custom.UI.MyDragSourceBehavior.prototype = { // IDragSource methods get_dragDataType: function() {... }, getDragData: function(context) {... }, get_dragMode: function() {... }, onDragStart: function() {... }, onDrag: function() {... }, onDragEnd: function(canceled) {... }, // Other methods initialize: function() {... }, mouseDownHandler: function(ev) {... }, dispose: function() {... }, } Custom.UI.MyDragSourceBehavior.registerClass('Custom.UI.MyDragSourceBehavior', Sys.UI.Behavior, Sys.Preview.UI.IDragSource); Custom.UI.MyDragSourceBehavior = function(element) { Custom.UI.MyDragSourceBehavior.initializeBase(this, [element]); this._mouseDownHandler = Function.createDelegate(this, this.mouseDownHandler);... } Custom.UI.MyDragSourceBehavior.prototype = { // IDragSource methods get_dragDataType: function() {... }, getDragData: function(context) {... }, get_dragMode: function() {... }, onDragStart: function() {... }, onDrag: function() {... }, onDragEnd: function(canceled) {... }, // Other methods initialize: function() {... }, mouseDownHandler: function(ev) {... }, dispose: function() {... }, } Custom.UI.MyDragSourceBehavior.registerClass('Custom.UI.MyDragSourceBehavior', Sys.UI.Behavior, Sys.Preview.UI.IDragSource);

Implementing IDropTarget Custom.UI.MyDropTargetBehavior = function(element) { Custom.UI.MyDropTargetBehavior.initializeBase(this, [element]);... } Custom.UI.MyDropTargetBehavior.prototype = { // IDropTarget methods get_dropTargetElement: function() {... } canDrop: function(dragMode, dataType, data) {... } drop : function(dragMode, dataType, data) {... } onDragEnterTarget : function(dragMode, dataType, data) {... } onDragLeaveTarget : function(dragMode, dataType, data) {... } onDragInTarget : function(dragMode, dataType, data) {... } // Other methods initialize: function() {... } dispose: function() {... } } Custom.UI.MyDropTargetBehavior.registerClass('Custom.UI.MyDropTargetBehavior', Sys.UI.Behavior, Sys.Preview.UI.IDropTarget); Custom.UI.MyDropTargetBehavior = function(element) { Custom.UI.MyDropTargetBehavior.initializeBase(this, [element]);... } Custom.UI.MyDropTargetBehavior.prototype = { // IDropTarget methods get_dropTargetElement: function() {... } canDrop: function(dragMode, dataType, data) {... } drop : function(dragMode, dataType, data) {... } onDragEnterTarget : function(dragMode, dataType, data) {... } onDragLeaveTarget : function(dragMode, dataType, data) {... } onDragInTarget : function(dragMode, dataType, data) {... } // Other methods initialize: function() {... } dispose: function() {... } } Custom.UI.MyDropTargetBehavior.registerClass('Custom.UI.MyDropTargetBehavior', Sys.UI.Behavior, Sys.Preview.UI.IDropTarget);

Using DragDropManager Call DragDropManager.registerDropTarget to register a drop target Typically done in drop target's initialize method Call DragDropManager.startDragDrop to begin a drag- drop operation Typically done in drag source's mouse-down handler Call DragDropManager.unregisterDropTarget to unregister drop target Typically done in drop target's dispose method

Drag-and-drop

Client-Side Data Binding PreviewScript.js 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......

Script-Callable 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; } } [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; } }

Client-side data binding

Resources Technical Communities, Webcasts, Blogs, Chats & User Groups Microsoft Learning and Certification Microsoft Developer Network (MSDN) & TechNet Trial Software and Virtual Labs ult.mspx ult.mspx New, as a pilot for 2007, the Breakout sessions will be available post event, in the TechEd Video Library, via the My Event page of the website Required slide: Please customize this slide with the resources relevant to your session MSDN Library Knowledge Base Forums MSDN Magazine User Groups Newsgroups E-learning Product Evaluations Videos Webcasts V-labs Blogs MVPs Certification Chats learn support connect subscribe Visit MSDN in the ATE Pavilion and get a FREE 180-day trial of MS Visual Studio Team System!

Complete your evaluation on the My Event pages of the website at the CommNet or the Feedback Terminals to win!

© 2007 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.