15.02.2015 Views

C# 4 and .NET 4

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

What is ajax ❘ 1223<br />

ConTrol<br />

Timer<br />

AsyncPostBackTrigger<br />

desCriPTion<br />

The ASP.<strong>NET</strong> AJAX Timer control is a useful way to cause an UpdatePanel<br />

to update periodically. You can configure this control to trigger postbacks at<br />

regular intervals. If this control is contained in an UpdatePanel control, then the<br />

UpdatePanel will be updated every time the Timer control is triggered. This<br />

control also has an associated event so that you can carry out periodic serverside<br />

processing.<br />

You can use this control to trigger UpdatePanel updates from controls that<br />

aren’t contained in the UpdatePanel. For example, you can enable a drop-down<br />

list elsewhere on a web page to cause an UpdatePanel containing a GridView<br />

control to update.<br />

The AJAX Extensions also include the ExtenderControl abstract base class for extending existing ASP.<br />

<strong>NET</strong> server controls. This is used, for example, by various classes in the ASP.<strong>NET</strong> AJAX Control Toolkit,<br />

as you will see shortly.<br />

AJAX Library<br />

The AJAX Library consists of JavaScript files that are used by client-side code in ASP.<strong>NET</strong> AJAX-enabled<br />

web applications. There is a lot of functionality included in these JavaScript files, some of which is general<br />

code that enhances the JavaScript language <strong>and</strong> some of which is specific to Ajax functionality. The AJAX<br />

Library contains layers of functionality that are built on top of each other, as shown in the following table.<br />

layer<br />

Browser compatibility<br />

Core services<br />

Base class library<br />

Networking<br />

User interface<br />

Controls<br />

desCriPTion<br />

The lowest-level code in the AJAX Library consists of code that maps various<br />

JavaScript functionality according to the client web browser. This is necessary<br />

because there are differences in the implementation of JavaScript in different<br />

browsers. By providing this layer, JavaScript code in other layers does not have to<br />

worry about browser compatibility, <strong>and</strong> you can write browser-neutral code that will<br />

work in all client environments.<br />

This layer contains the enhancements to the JavaScript language, in particular OOP<br />

functionality. By using the code in this layer you can define namespaces, classes,<br />

derived classes, <strong>and</strong> interfaces using JavaScript script files. This is of particular<br />

interest to <strong>C#</strong> developers, because it makes writing JavaScript code much more like<br />

writing .<strong>NET</strong> code (by using <strong>C#</strong> <strong>and</strong> encouraging reusability).<br />

The client base class library (BCL) includes many JavaScript classes that provide lowlevel<br />

functionality to classes further down the AJAX Library hierarchy. Most of these<br />

classes are not intended to be used directly.<br />

Classes in the networking layer enable client-side code to call server-side code<br />

asynchronously. This layer includes the basic framework for making a call to a<br />

URL <strong>and</strong> responding to the result in a callback function. For the most part, this is<br />

also functionality that you will not use directly; instead, you will use classes that<br />

wrap this functionality. This layer also contains classes for JSON serialization <strong>and</strong><br />

deserialization. You will find most of the networking classes on the client-side Sys.<br />

Net namespace.<br />

This layer contains classes that abstract user interface elements such as HTML<br />

elements <strong>and</strong> DOM events. You can use the properties <strong>and</strong> methods of this layer to<br />

write language-neutral JavaScript code to manipulate web pages from the client. User<br />

interface classes are contained in the Sys.UI namespace.<br />

The final layer of the AJAX Library contains the highest-level code, which provides<br />

Ajax behaviors <strong>and</strong> server control functionality. This includes dynamically<br />

generated code that you can use, for example, to call Web services from client-side<br />

JavaScript code.<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!