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.

Table 4.15. Availability of Data Binding Options
 

Nonhierarchical (Rowset) Data

Hierarchical (XML) Data

Returns a Single Value

Returns a Collection

Supports Formatting

A

B

C

D

E

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

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

graphics/04fig10.jpg

The resulting page displays all the rows from that table, as shown in Figure 4.11 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.

Figure 4.11. Viewing the results

graphics/04fig11.gif

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.



A First Look at ASP. NET v. 2.0 2003
A First Look at ASP. NET v. 2.0 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net