Chapter 3. Displaying and Editing with the GridView Control

In This Chapter

Viewing simple data with GridView

Changing the appearance of the display

Adding edit and delete capabilities for data

Sorting and paging

Defining fields

If you’ve done database programming with ASP.NET in the past, you might have worked with the DataGrid control. The DataGrid control was a useful control for displaying and editing data in a grid fashion on a Web page. But that was just Microsoft’s first take. Now, Microsoft has given us a much more powerful control, the GridView control. In this chapter I introduce the two of you: Meet GridView. GridView, meet Reader.

Setting Up the AdventureWorks Database

In many of the examples throughout this chapter, I refer to the AdventureWorks database. That’s a database that ships with the various 2005 editions of SQL Server.

If you don’t have a copy of the AdventureWorks database, you can download it from Microsoft for free at:

www.microsoft.com/downloads/details.aspx?familyid=E719ECF7-9F46-4312-
    AF89-6AD8702E4E6E

Or, instead of typing that in, simply go to www.microsoft.com/downloads and type SQL Server 2005 Samples into the search box, and click Go. In the results, choose SQL Server 2005 Samples and Sample Databases. When you’ve found this page, click the link labeled AdventureWorksDB.msi, then follow the instructions to download and install the sample database.

After you’ve downloaded and installed the database, you need to create a connection from Visual Studio 2005. ...

Get ASP.NET 2.0 All-In-One Desk Reference For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.