Adding an Event Handler for a Web Control's Event

As we saw in the last hour, to add the Click event handler for the Button Web control, all we need to do is double-click the button in the designer. This action will take us directly to the Code tab, where we can enter the source code for the event handler. Web controls can have more than one event, but all Web controls have what is known as the default event. When double-clicking a Web control in the designer, the event handler for its default event is created.

Since Web controls can have more than one event, you may be wondering how one would add another event handler for the Button Web control besides its Click event. To add an event handler for an event other than the default event, we must ...

Get SAMS Teach Yourself ASP.NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.