Chapter 1 provided 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.
To talk about events, you must understand controls. To talk about controls, you must first know about events. We’ll solve this classic chicken-and-the-egg problem by providing just enough information in this chapter about controls to understand events. The next two chapters will discuss controls in depth.
The two models of program execution (which are not necessarily mutually exclusive) are 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 generated (or 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 you open for reading ...