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.








Sys.CancelEventArgs Class

Provides the base class for events that can be canceled.

Namespace: Sys

Inherits: Sys.EventArgs


var args = new Sys.CancelEventArgs();




CancelEventArgs Constructor

Initializes a new instance of the CancelEventArgs class.




cancel Property

Gets or sets a value that specifies whether the event source should cancel the operation that caused the event.


This class contains private members that support the client-script infrastructure and are not intended to be used directly from your code. Names of private members begin with an underscore ( _ ).


Event handlers can use the cancel property to cancel the operation in progress. The semantics of canceling an event depend on the event source.


The following example shows how to use the cancel property of the InitializeRequestEventArgs class, which derives from the CancelEventArgs class. In this example, a handler for the initializeRequest event enables an asynchronous postback to be canceled. Script in the handler determines whether an asynchronous postback is currently in progress by using the isInAsyncPostBack property of the PageRequestManager class. If a postback is in progress, the postBackElement property is used to determine the ID of the element that caused the postback. If the ID matches the ID of a button that cancels the postback, the abortPostBack method is called. Otherwise, the current request is canceled by using the cancel property of the CancelEventArgs class.