System.Web.UI.ICallbackEventHandler

Used to indicate that a control can be the target of a callback event on the server.

See Also: ICallbackEventHandler Members

Syntax

public interface ICallbackEventHandler

Remarks

Implement the System.Web.UI.ICallbackEventHandler interface for any custom control that needs to receive callback events. For more information, see Client Callbacks Without Postbacks in ASP.NET Pages.

Examples of controls that implement the System.Web.UI.ICallbackEventHandler interface include the System.Web.UI.WebControls.GridView, System.Web.UI.WebControls.DetailsView, and System.Web.UI.WebControls.TreeView controls. When a callback event targets a control that implements the System.Web.UI.ICallbackEventHandler interface, the ICallbackEventHandler.RaiseCallbackEvent(string) method is called to handle the event, passing the event argument as a parameter and the ICallbackEventHandler.GetCallbackResult method returns the result of the callback.

Controls that retrieve data from a data source control during callback can do so synchronously or asynchronously. ASP.NET controls like System.Web.UI.WebControls.GridView, System.Web.UI.WebControls.DetailsView, and System.Web.UI.WebControls.TreeView are implemented synchronously. Synchronous callbacks do not prevent the user from working in the browser. In synchronous mode, only one callback at a time can execute, with the last callback taking precedence. When a Web control is implemented to support asynchronous behavior, multiple callbacks can be raised simultaneously. For details on asynchronous programming, see Asynchronous Programming Design Patterns.

You can specify whether callback events originating from the user interface rendered by a control implementing the System.Web.UI.ICallbackEventHandler interface are validated. Validation of events is a good security practice. However, for performance reasons you can disable it. To control whether event validation is performed on callback events, set the enableEventValidation attribute of the @ Page directive or the enableEventValidation attribute of the pages Element (ASP.NET Settings Schema) of the Web.config file. If you set the Page.EnableEventValidation property in code, set it in the Page_Init phase of page processing. For more information on balancing the security benefit of event validation with its performance cost, see Performance Overview.

Requirements

Namespace: System.Web.UI
Assembly: System.Web (in System.Web.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0