event is an action that occurs as a result of the user or another source, such as a mouse being clicked, or a key being pressed. An event handler is a routine that is used to deal with the event, allowing a programmer to write code that will be executed when the event occurs.

Another example of an event is a user clicking on a button within a web page. This action creates what is known as a "click" event.

Events in ASP.NET raised at the client machine, and handled at the server machine. For example, a user clicks a button displayed in the browser. A Click event is raised. The browser handles this client-side event by posting it to the server.

in .NET. AEH is an event handler for your WinForms application. The primary functionality of this component is to raise an event after every form loads into memory so that we can handle its event for performing any custom code processing and return the control to the form after processing.

ASP.NET event handlers generally take two parameters and return void. The first parameter represents the object raising the event and the second parameter is event argument.


One of the key features of ASP.NET is that it uses an event-based programming model.

In the simple Hello World example, we added a small bit of programming to a method named Page_Load .

This method is an event handler.

An event handler is a method that determines what actions are performed when an event occurs, such as when the user clicks a button or selects an item from a list.

When an event is raised, the handler for that specific event is executed.


In the .NET Framework, all event handlers have a specific method signature, that is, a specific return type and parameters.

Event handlers are always void methods.

Event handlers always accept two parameters:

• an object parameter

• an EventArgs parameter

• (or a subclass of EventArgs, such as CommandEventArgs or ImageClickEventArgs ).

Dim WithEvents myHandler As New AEHC.ApplicationEventHandler
Public frCol As ArrayList

Public Sub main()
    'Attaches the Form Filter to the Application

    Application.Run(New Form1)
End Sub

Private Sub myHandler_FormLoaded(ByRef sender As System.Windows.Forms.Form, _
      ByVal e As AEHC.AppEventHandlerArgs) Handles myHandler.FormLoaded
    sender.Text = Now.ToLocalTime
End Sub

Private Sub myHandler_FormUnloaded(ByVal e As AEHC.AppEventHandlerArgs) _
                                           Handles myHandler.FormUnloaded
    MsgBox(e.FormsCollection.Count & " in memory")
End Sub


The event system in ASP.NET operates in a different manner than in a Windows application or from the event system in browser-based Javascript.

In a Windows application, for instance, events are raised and handled on the same processor.

In contrast, ASP.NET events are raised on the client (the browser) but transmitted to and handled on the server.


There are two types of Event.

1) Page events:Page event Always triggered and always in a certain specific order

Page events are

DataBinding - It is raised when a control binds to a data source.

Unload - It is raised when the page or control is unloaded from memory.

Error - It is a page event, occurs when an unhandled exception is thrown.

Init - It is raised when the page or the control is initialized.

Load - It is raised when the page or a control is loaded.

Disposed - It is raised when the page or the control is released.

PreRender - It is raised when the page or the control is to be rendered.

2) Control events/Session Event :Control event Associated with particular controls and only triggered in certain circumstances

Control/ session events are

Application_Start - It is raised when the application/website is started.

Application_End - It is raised when the application/website is stopped.

Similarly, the most used Session events are:

Session_Start - It is raised when a user first requests a page from the application.

Session_End - >It is raised when the session ends.

For Share :-