In Chapter 2, you saw just a glimpse of ASP.NET. Now you might be asking yourself (especially if you’re a developer experienced in classic ASP), “What’s the big deal?” One of the significant differences between ASP.NET and classic ASP is that ASP.NET is event-driven.
In order to talk about events, you need to understand controls. In order to talk about controls, you must first know about events. We’ll solve this classic chicken-and-egg problem by providing just enough information in this chapter about controls to understand events. The next two chapters will cover controls in depth.
There are two models of program execution, which are not necessarily mutually exclusive: linear and event-driven.
Linear programs move in a linear fashion from step 1 to step 2 and so
on to the end of all the steps. Flow control structures within the
code, such as loops,
if statements, or function or
subroutine calls, may redirect the flow of the program, but
essentially, once program execution begins, it runs its course
unaffected by anything the user or system may do. Prior to the advent
of GUI environments, most computer programs were linear.
In contrast, event-driven programming responds to events. An event is
raised) when “something happens,” such as the user pressing a button. Often events are generated by user action, but events can also be generated by the system starting or finishing work. For example, the system might raise an event when a file that ...