Updating content on web page

In previous tutorials we learned how the Object Data Source control allowed for inserting, updating, and deleting of data.The Sql Data Source control supports the same operations, but the approach is different, and this tutorial shows how to configure the Sql Data Source to insert, update, and delete data.When the Sql Data Source control s method is invoked either programmatically or automatically from a data Web control a connection to the database is established, the parameter values are assigned to the query, and the command is shuttled off to the database.

However, this approach requires that we manually write out the SQL statements by hand, which can be monotonous and error-prone.

As Figure 4 shows, when the page is visited through a browser a Delete button is included. Figure 4: Each Grid View Row Now Includes a Delete Button (Click to view full-size image) Upon clicking a Delete button, a postback occurs, the Grid View assigns the Figure 5 depicts this interaction graphically.

Refer back to the Examining the Events Associated with Inserting, Updating, and Deleting tutorial for a more detailed discussion on the chain of events associated with inserting, updating, and deleting from a data Web control.

Since the Note The Details View s inserting and editing interfaces lack any sort of customization or validation.

To add validation controls or to customize the interfaces, you need to convert the Bound Fields to Template Fields.

Leave a Reply