This tutorial will show Controls how to Handle Server Event using ASP.NET 2.0 and C#

An important feature of ASP.NET is that it allows you to program Web pages using an event-based model that is similar to that in client applications.If you already have an event handler, you can bind several control events to it. These multiple events can be from the same control or one event from several different controls, as long as the events all have the same method signature.

This tutorial only using the default namespace.The System namespace contains the EventHandler.

We use the Buttonx_Click event to connect multiple events to a single event handler. In the other word, Button1,Button2,Button3(multiple events will be connected to single event handler) will call same event handler. But this event handler will determine which Web Server Control Raised an Event. And then, we use the Button6_Click event to call eventd of both Button4 and Button5.

The front end .aspx page looks something like this:

The flow for the code behind page is as follows.

Download Source Files