ASP.NET and Web Forms provide you with a powerful way to create programmable Web pages in C#. Web Forms are server-based, meaning that the code runs on the server, producing HTML output that’s sent to the browser. When users click a button in a Web Forms page, it sends the page to the server for processing—that is, it makes a round-trip. Because of the inherently stateless nature of the Web, you need to understand how the page and its controls maintain their values between round-trips and how you must do the same for values you want to preserve. Web server controls provide Web Forms pages with rich, consistent objects that you can work with using a standard event-driven model.
To access data in Web Forms, you can use datasets as you do in Windows Forms, but it’s often more efficient to execute database commands directly. To display data in lists, you use the Repeater, DataList, and DataGrid controls. For the Repeater and DataList controls, you define templates in which you arrange controls and static text to specify the layout of each data item. The DataGrid control is the richest of the Web Forms data list controls; it provides you with the ability to add editing, although you must implement some of the logic yourself.
Web Forms and ASP.NET are complex areas in their own right, and the information in this chapter has provided only an overview of what they’re for and how they work. For more in-depth information about Web Forms, refer to the MSDN Library.