Examining when the Events of a Web Control Fire

As we saw in the previous hour, Web controls can have events. For example, we have seen that the Button Web control has a Click event. In Hour 2 we discussed the fact that events can be associated with event handlers. An event handler is a piece of source code that is executed whenever its associated event fires. With the FinancialCalculator.aspx example, we created an event handler for the Button Web control's Click event that computed the monthly cost of the mortgage based upon the user's input.

But when do events fire? From the name of it, one might expect the Button Web control's Click event to fire immediately after the user has clicked the button, but this isn't exactly the case. Recall from ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.