AJAX Now with ASP'NET 2'0 - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

AJAX Now with ASP'NET 2'0

Description:

Interface has a single method and any callback to the page goes back to ... http://jason.diamond.name/weblog/2005/07/06/my-ajax-dot-net-library - Jason Diamond ... – PowerPoint PPT presentation

Number of Views:55
Avg rating:3.0/5.0
Slides: 10
Provided by: brando94
Category:
Tags: ajax | asp | net | now | weblog

less

Transcript and Presenter's Notes

Title: AJAX Now with ASP'NET 2'0


1
AJAX Now with ASP.NET 2.0
  • Jim Zimmerman

2
AGENDA
  • Overview of AJAX
  • Client Script Callbacks in ASP.NET 2.0
  • Demo using Script Callbacks
  • Demo using Jason Diamonds Library
  • Atlas
  • AJAX for .NET 1.1
  • Where to go from here?

3
Overview of AJAX
  • Asynchronous JavaScriptCSSDOMXMLHttpRequest
  • Remote Scripting
  • Whos Using AJAX
  • Google Maps, Gmail, Suggest
  • Yahoo Flickr
  • Microsoft Outlook Web Client
  • Ajax isnt something you can download
  • Dont need to use XML

4
Client Script Callbacks
  • New to ASP.NET 2.0
  • Are similar to Postbacks in .NET 1.1
  • Works cross-platform.
  • ICallbackEventHandler Problems
  • Interface has a single method and any callback to
    the page goes back to this single handler
  • Single handler has no context to tell which
    control it's dealing with
  • The RaiseCallbackEvent method can only accept a
    single string and return a single string

5
Demo using Script Callbacks
  • Create a delegate for the ICallbackEventHandler
  • public MyAjax.EventControl ProductListEventContro
    l new MyAjax.EventControl()
  • Generate the client script for the control
  • ProductListEventControl.ScriptCallback new
    MyAjax.delScriptCallBack(GetProductDetails)
  • ScriptRef this.GetClientScript(ProductListEvent
    Control, "productList", "GetProductDetails")
  • this.productList.Attributes.Add("onchange",
    ScriptRef)
  • Create JavaScript handler for the result
  • function GetProductDetails(Result,Context)
  • // alert (Result)
  • Detail document.getElementById('divConte
    nts')
  • Detail.style.display''
  • Detail.innerHTML 'ltpregt' Result
    'lt/pregt'
  • Limitations
  • ICallbackEventHandler.RaiseCallbackEvent method
    can only accept a single string and return a
    single string

6
Demo using Jasons Library
  • Jason Diamond created a library that was not
    dependent on use of a separate IHttpHandler
    implementation to process the callback requests
    like what is used in AJAX.NET
  • Register the script
  • Ajax.Manager.Register(this, "My.Page",
    Ajax.Debug.None)
  • Create the c method in the code behind
  • Ajax.Method
  • public DataSet GetDataSet()
  • DataSet ds new DataSet()
  • ds.Tables.Add(GetDataTable())
  • return ds
  • Create the JavaScript
  • function PopulateListWithDataSet()
  • My.Page.GetDataSet(DoSetCallBack)
  • document.getElementById("_popSetButton").value
    "Getting DataSet..."

7
Atlas Client Script Framework
  • 100 JavaScript client framework
  • Make it real easy for developers
  • Will work on all modern browsers
  • The Atlas Client Script Framework will include
    the following components
  • An extensible core framework that adds features
    to JavaScript such as lifetime management,
    inheritance, multicast event handlers, and
    interfaces
  • A base class library for common features such as
    rich string manipulation, timers, and running
    tasks
  • A UI framework for attaching dynamic behaviors to
    HTML in a cross-browser way
  • A network stack to simplify server connectivity
    and access to web services
  • A set of controls for rich UI, such as
    auto-complete textboxes, popup panels, animation,
    and drag and drop
  • A browser compatibility layer to address
    scripting behavior differences between browsers.
  • http//weblogs.asp.net/scottgu/archive/2005/06/28/
    416185.aspx

8
AJAX for .NET 1.1
  • http//ajax.schwarz-interactive.de/csharpsample/de
    fault.aspx - Michael Schwarz
  • http//jason.diamond.name/weblog/2005/07/06/my-aja
    x-dot-net-library - Jason Diamond

9
Where to go from here?
  • Think about what situations would be enhanced by
    AJAX style coding
  • Download the demo source code and presentation
    at
  • http//aspnet2examples.blogspot.com
  • Prototype AJAX friendly scenarios
Write a Comment
User Comments (0)
About PowerShow.com