Appendix D. ASP.NET AJAX Reference

ASP.NET AJAX provides several JavaScript helper APIs and adds new functionality to existing JavaScript objects. This appendix shows a selective list of the most important functions and methods.

Helper Functions

ASP.NET AJAX comes with several useful helper functions. The most important ones have shortcut function names prefixed with a dollar sign ($).

Property

Description

$addHandler(element, eventName, handler);

Adds an event handler for an event to a DOM element

$addHandlers(element, events, handlerOwner)

Adds several event handlers to a DOM element

$clearHandlers(element)

Removes all event handlers attached to a DOM element

$create(type, properties, events, references, element)

Creates a component and initializes it

$find(id, parent)

Searches for a component by its ID

$get(id, element)

Searches for a DOM element by its ID

$removeHandler(element, eventName, handler)

Removes one specific event handler from a DOM element

Object Extensions

ASP.NET AJAX extends some standard JavaScript objects like strings and Booleans with additional methods. The extensions for the JavaScript Error object are mostly used internally, but the other object extensions are also suitable for custom code.

Array Extensions

All Array methods need to be called statically (e.g., Array.add( )).

Method

Description

add(array, item)

Adds an element to the array

addRange(array, items)

Adds elements to the array

clear(array)

Empties the array

clone(array)

Creates a copy of the array

contains(array, item)

Whether ...

Get Programming ASP.NET AJAX now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.