Buttons are controls that post the form back to the server, enabling server-side processing to commence. There are three types of button controls:
In addition to the properties, methods, and events inherited along with all the other ASP controls, all three button types have the following two events:
Raised when control is clicked and no command name is associated with the button (i.e., no value has been assigned to the Button control’s CommandName property). The method is passed an argument of type EventArgs.
Raised when the control is clicked and a command name is associated with the button (i.e., a command name has been assigned to the Button control’s CommandName property). The event is passed an argument of type CommandEventArgs, which has the following two members:
The name of the command
An optional argument for the command
The code in Example 5-5 and Example 5-6 creates a web page containing three buttons, one of each type. Each button performs the same task: transferring control to another web page. Example 5-5 shows the C# code, and Example 5-6 shows the same code in VB.NET. Figure 5-3 shows the web page that results from running the example code.