Chapter 13

Displaying and Updating Data

What You Will Learn in This Chapter:

  • 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 Code Downloads for this Chapter

You can find the code downloads for this chapter on the Download Code tab at The code is in the Chapter 13 download.

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.

Data Controls

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

Get Beginning ASP.NET 4.5: 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.