7.1. Our First Web Forms Program

Our first Web page represents an employee phone directory. It is pictured in Figure 7.1. The employee data is pulled out of a SQL database and displayed within a DataGrid control.[2] To illustrate selection within the data grid, our page pretends to dial the selected employee. To illustrate the use of a check box, the page optionally initiates a video stream as well. (The dial-up and video stream support are generously left as exercises for the reader.) The selected employee is highlighted within the data grid. In addition, the person selected, the associated phone number, and whether the video option has been checked are displayed within the text of a label—for example,

[2] The database is the NorthWind sample SQL Server database supplied by Microsoft.

Figure 7.1. A Client Browser Web Forms Page Display


OK. Dialing: Andrew Fuller at (206) 555-9482 with video on.

The page also displays the current time and provides two links: one to a second Web Forms page built within the project (the Author link), and one to a URL on the Web (the Recital image).

The Web Forms page design and supporting C# code are implemented in much the same way as in Windows Forms. The Toolbox window contains controls that we can drag and drop onto our Web Forms page. Each control has its own Properties window, and there is a Properties window for the page as well.

Although the Web Forms development experience mirrors that of Windows Forms, the Web Forms processing model is much different. The browser through which the user views and interacts with the page represents the client side of the application. Our code executes on the server side. The handling of an event, such as a button click, represents a round-trip to the server and back.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.9.169