Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Skip Navigation Links.
Tutorials
Sample ASP.NET AJAX Application
ASP.NET AJAX and JavaScript
Extending JavaScript with ASP.NET AJAX
Creating Custom Client Script in ASP.NET AJAX
Dynamically Assigning ASP.NET AJAX Script References
Globalizing a Date by Using Client Script
Embedding a JavaScript File as a Resource in an Assembly
Embedding Localized Resources for a JavaScript File
Adding Localized Resources to a JavaScript File
Creating Custom Client Events
The UpdatePanel Control
Introduction to the UpdatePanel Control
Creating a Simple ASP.NET Page with Multiple UpdatePanel Controls
Using the UpdatePanel Control with Data-Bound Controls
Using the UpdatePanel Control with Master Pages
Using the UpdatePanel Control with User Controls
Using the UpdatePanel Control with a Web Service
Customizing Error Handling for UpdatePanel Controls
Animating UpdatePanel Controls
Canceling an Asynchronous Postback
Giving Precedence to a Specific Asynchronous Postback
Working with PageRequestManager Events
The UpdateProgress Control
Introduction to the UpdateProgress Control
Programming UpdateProgress Controls in Client Script
The Timer Control
Introduction to the Timer Control
Using the Timer Control with Multiple UpdatePanel Controls
ASP.NET Application Services
Using Forms Authentication
Using Profile Information
Web Services
Exposing Web Services to Client Script
Calling Web Services from Client Script
ASP.NET AJAX Extensibility
Creating Custom ASP.NET AJAX Non-Visual Client Components
Creating Custom ASP.NET AJAX Client Controls
Creating an Extender Control
Adding Client Capabilities to a Web Server Control
Creating a Client Component Class Using the Prototype Model
Defining Custom Component Properties and Raising PropertyChanged Events
Releasing Component Resources

Defining Custom Component Properties and Raising PropertyChanged Events

Introduction

When you create a client component class, you define the properties that you expect page developers to access. You can also raise Sys.Component.propertyChanged notification events in the set accessors for properties of your component. Page developers who use the component can bind the property notification event to their own handler to run code when the property value changes.

Defining Public Properties in a Custom Client Component

In client components, property accessors are defined as methods of the class prototype. The accessor methods are named with get_ and set_ prefixes followed by the property name. The following example shows how to define a read-write property named interval in the class prototype.

get_interval: function() {
    return this._interval;
},
set_interval: function(value) {
    this._interval = value;
}

Raising a PropertyChanged Event

You can invoke the Sys.Component raisePropertyChanged method in a property set accessor to raise a propertyChanged event. Your component inherits the raisePropertyChanged method from the Sys.Component, Sys.UI.Behavior Class CTP, or Sys.UI.Control base class.

The following example shows how to raise a propertyChanged event for an interval property whenever the property is set.

get_interval: function() {
    return this._interval;
},
set_interval: function(value) {
    if (this._interval !== value) {
        this._interval = value;
        this.raisePropertyChanged('interval');
    }
}

For an example of how to raise and handle a custom component's propertyChanged event, see Creating Custom ASP.NET AJAX Non-Visual Client Components. For more information about the raisePropertyChanged method, see raisePropertyChanged Method.