May 28, 2011, 6:51 p.m.
posted by ninjacat
Building Data-Bound Pages with Visual Studio .NET "Whidbey"
In this and the previous chapter, we've concentrated on the new controls that are part of ASP.NET 2.0 and make it easy to build data-bound pages that can display and update data. We showed you how easy it is to declare the controls you need and how to add attributes to change the appearance or behavior of the controls. But the main focus has been to help you understand what the controls do and how they are used as part of the overall page design process.
However, it is even easier to build these kinds of pages using a suitable development tool or environment. We introduced Microsoft's Visual Studio .NET "Whidbey" tool in Chapter 2, and you saw how comprehensive it is. It is ideal for building data-bound pages—you can open a connection to a database in the Data Explorer window and then simply drag a table onto the design surface. This automatically creates the appropriate SqlDataSource and GridView controls and sets the relevant properties (see Figure).
The resulting page displays all the rows from that table, as shown in Figure on the next page. You can then use the Common Tasks menus or the Properties window to configure the GridView and SqlDataSource controls, apply formatting, add sorting and paging, and so on.