Professional Documents
Culture Documents
Michael Schwarz Info@schwarz-Interactive - de Last Update: 09. August 2005
Michael Schwarz Info@schwarz-Interactive - de Last Update: 09. August 2005
Michael Schwarz Info@schwarz-Interactive - de Last Update: 09. August 2005
NET
1st AJAX library for Microsoft .NET
Michael Schwarz
info@schwarz-interactive.de
http://www.schwarz-interactive.de
Last update: 09. August 2005
STRICTLY CONFIDENTIAL 1
Ajax.NET – How it works
Add reference ajax.dll to your project
Modify your web.config to configure
IHttpHandler for Ajax.NET requests
Write your methods in C#/VB.NET and
add the attribute [AjaxMethod]
Call Class1.Method1(param1, param2,
callback, context); from client-side
JavaScript
STRICTLY CONFIDENTIAL 2
Ajax.NET – Key Benefits (1)
Methods only get attribute, no need to
implement interface or inherit from class
[AjaxMethod]
public int GetAge(string username){…}
Source-code doesn‘t change if you want to
use the method in server-side code
DemoMethods dm = new DemoMethods();
int age = dm.GetAge(“michael“);
WebServices can be used without code
change:
<script type= “text/javascript“ src=“servie1.asmx?AJAX“></script>
STRICTLY CONFIDENTIAL 3
Ajax.NET – Key Benefits (2)
Client-side JavaScript will get “real“
objects from Ajax.NET calls using JSON
<script type=“text/javascript“>
function test_callback(res) {
alert(res.value.FirstName + ‘ ‘ + res.value.FamilyName); }
</script>
STRICTLY CONFIDENTIAL 4
Ajax.NET – Key Benefits (3)
Cache requests (CacheDurationTimeSpan)
Access SessionState objects using
HttpContext.Current.Session[…]
Context support for callback method
Unicode support without use of XML
parser
Use Ajax.NET to retreive “events“ instead
of polling
STRICTLY CONFIDENTIAL 5
Ajax.NET – Ideas (1)
ViewState access (read/update) in
Ajax.NET methods
Access controls of page if Ajax.NET
method is placed in WebForm.
The first idea was to use Ajax.NET methods only in seperate
classes.
STRICTLY CONFIDENTIAL 6
Ajax.NET – Ideas (2)
DataBinding/DataGrid using Ajax.NET,
every click on „next page“ will call
Ajax.NET method. asp:DataGrid tags will
be parsed by client-side JavaScript
FileUpload control with events:
OnUploaded, OnUploading (ProgressBar, bytes, percent,…),
OnError
STRICTLY CONFIDENTIAL 7
Ajax.NET – Ideas (3)
QueryString from the original requested
page
Use any object as Ajax.NET method
argument without creating an
IAjaxObjectConverter
Configure how an Image will be returned
ImageFormat, JPEG Compression,…
STRICTLY CONFIDENTIAL 8
Ajax.NET – Ideas (4)
Call Ajax.NET methods from different
servers and load balancing
Internet Explorer will not allow posting data to different domains by default.
STRICTLY CONFIDENTIAL 9
Ajax.NET – Ideas (5)
A more complex event handler for
JavaScript events from server-side code
Server-side code:
Watcher watcher = new Watcher();
watcher.Changed += new AjaxWatchEventHandler(…);
Client-side code:
ajax.OnWatchEvent = function(…){}
Server.TransferSilent/RedirectSilent
used for web sites (instead of web applications) to get rid of the
postback and full page reload
STRICTLY CONFIDENTIAL 10
Ajax.NET – Ideas (6)
Create HTML files that represent different
Ajax.NET calls (keyword Google Sitemap).
STRICTLY CONFIDENTIAL 11
Q&A ??
See examples at
http://ajax.schwarz-interactive.de
Search google.com for “Ajax.NET“
Contact me by email
info@schwarz-interactive.de
STRICTLY CONFIDENTIAL 12