Explore Ways to Extend ASP.NET AJAX Client-Side Function
page 2 of 9
by Xianzhong Zhu
Feedback
Average Rating: 
Views (Total / Last 10 Days): 15314/ 292

The Component Way

As mentioned above, behaviors allow you to create specific functionality that can be reused and attached to specific controls and elements on your page.

Now, let us first take a glimpse at the prototype definition of Sys.Component to make us more familiar with the basic functionality of Sys.Component.

Listing 1: Prototype definition for Sys.Component

Sys.Component.prototype = {
      _id: null,
      _idSet: false,
      _initialized: false,
      _updating: false,
      get_events: Sys$Component$get_events,
      get_id: Sys$Component$get_id,
      set_id: Sys$Component$set_id,
      get_isInitialized: Sys$Component$get_isInitialized,
      get_isUpdating: Sys$Component$get_isUpdating,
      add_disposing: Sys$Component$add_disposing,
      remove_disposing: Sys$Component$remove_disposing,
      add_propertyChanged: Sys$Component$add_propertyChanged,
      remove_propertyChanged: Sys$Component$remove_propertyChanged,
      beginUpdate: Sys$Component$beginUpdate,
      dispose: Sys$Component$dispose,
      endUpdate: Sys$Component$endUpdate,
      initialize: Sys$Component$initialize,
      raisePropertyChanged: Sys$Component$raisePropertyChanged,
      updated: Sys$Component$updated
}
Sys.Component.registerClass('Sys.Component', null, Sys.IDisposable, 
Sys.INotifyPropertyChange, Sys.INotifyDisposing);

As is seen above, by deriving from the Component base class, your custom component automatically will inherit many supported features, including the following.

·         A cross-browser model for managing handler bindings to client object events

·         Automatic registration of the component in the client application as a disposable object that implements the Sys.IDisposable interface

·         Raising of notification events when properties are changed

·         Performing batch processing of component property settings, which is more efficient in script size and processing time than handling all logic in individual property get and set accessors

·         An override of the Sys.UI.Control.initialize method to initialize any properties and event listeners

MS AJAX has many built-in components, such as Application, Timer, Validator, etc. which greatly enhanced the client-side function. In the next section, however, we are going to create our own MS AJAX client-side custom components.


View Entire Article

User Comments

No comments posted yet.






Ads Powered by Lake Quincy Media
Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2008 ASPAlliance.com  |  Page Processed at 7/5/2008 1:34:28 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search