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

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

Title: ZK@Web Marketing Blog   
Name: zk5182@yahoo.com
Date: 2009-06-03 1:35:51 AM
I downloaded the ASP.NET 2.0 PayPal Commerce Starter Kit (CSK) today for kicks and ended up creating a new provider, called InventoryProvider, that provides the basis for a more functional and feature-rich inventory management system. I say "provides the basis," because my immediate intentions were to do the minimal amount of work possible to have CSK use the provider and then add new features in increments later.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-23 12:35:39 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search