Chapter 13. Displaying and Updating Data


  • How to display, insert, edit, and delete data using controls such as GridView, DetailsView, and SqlDataSource

  • How to create a rich interface that enables a user to insert and edit data while maintaining data integrity with the ASP.NET validation controls

  • The best way to store your connection strings in your application so they are easily updatable

In this chapter you learn how to display, insert, update, and delete data using the popular data controls that ship with ASP.NET. Besides working with the visual controls that are used to display and edit data in a web page, you also learn how to work with the SqlDataSource control that acts as the bridge between the database and your ASPX pages.

The first things you need to look at are the available data controls, discussed in the next section.


To enable you to work efficiently with the data in your system, ASP.NET offers two sets of data-aware controls: the data-bound controls and the data source controls.

The first group contains controls that you use to display and edit data, such as the GridView, Repeater, and ListView controls in the user interface. The data source controls are used to retrieve data from a data source, like a database or an XML file, and then offer this data to the data-bound controls. Figure 13-1 shows you the complete list of available data controls in the Data category of the Toolbox.

Figure 13.1. FIGURE 13-1

The following three ...

Get Beginning ASP.NET 4: in C# and VB now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.