Updating Data with the DetailsView Control

You can use the DetailsView control to update existing database records. To update an existing record, assign the value True to the DetailsView control’s AutoGenerateEditButton property, as illustrated in Listing 12.10 (see Figure 12.7).

Figure 12.7. Editing a record with the DetailsView control.

image

Listing 12.10. ShowUpdate.aspx

images

When you open the page in Listing 12.10, the record appears in Read Only mode. You can click the Edit button to switch the DetailsView into Edit mode and update the record.

Get ASP.NET 4 Unleashed 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.