Building Data-Bound Pages with Visual Studio .NET "Whidbey"

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.

Availability of Data Binding Options

Nonhierarchical (Rowset) Data

Hierarchical (XML) Data

Returns a Single Value

Returns a Collection

Supports Formatting






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).

10. Creating a data-bound page with Visual Studio .NET "Whidbey"


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.

11. Viewing the results


Note that, by default, Visual Studio .NET "Whidbey" changes the ProviderName property of the SqlDataSource control from the default of System.Data.SqlClient to System.Data.OleDb in order to provide maximum compatibility with all types of relational databases.

     Python   SQL   Java   php   Perl 
     game development   web development   internet   *nix   graphics   hardware 
     telecommunications   C++ 
     Flash   Active Directory   Windows