Events in ASP.NET Server Controls
Unlike events in desktop applications, ASP.NET server-control events are raised as well as handled on the server. When a Web request communicates a client-side action to the server, a control can raise events on the server in response to the client action. The event is handled by the page or by its child controls, and ASP.NET sends a response back to the client. This results in a user experience similar to that of a desktop application. However, control developers must understand that only one client-side event is posted to the server — the postback event. Common user-interface events such as mouse clicks or key presses are not communicated to the server and thus cannot be processed on the server.
The base class System.Web.UI.Control provides the events that govern a control's execution lifecycle, such as initialization, loading, and unloading. For the sequence in which these events are executed, see Control Execution Lifecycle. You can handle these events as well as raise additional events from your control. This section shows how to handle inherited events and how to raise custom events.
In This Section
- Defining an Event
- Describes how to expose an event from a control.
- Handling Inherited Events
- Describes how a control can handle events that it inherits from Control.
- Processing Postback Data
- Describes how to program a control to handle postback data.
- Capturing Postback Events
- Describes how to program a control to receive a postback event.
- Generating Client-Side Script for Postback
- Describes how to emit client-side script that initiates postback.
- Bubbling an Event
- Describes event bubbling in ASP.NET controls.