Code for updating the database
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.Clicking the Edit button turns the Details View into edit mode, which displays each Bound Field whose (the default) as a Text Box, and the Check Box Field as a checkbox.Figure 9: The Details View s Default Editing Interface (Click to view full-size image) Similarly, you can delete the currently selected product or add a new product to the system.From the Designer in Sql Data Source and then bring up the Properties window (from the View menu, choose Properties window, or simply hit F4).Select the Delete Query property, which will bring up a set of ellipses.
Once we add deleting support to the Grid View, the Grid View will automatically supply this parameter value, using the value of its property added, the Grid View s smart tag now contains the Enable Deleting option. As discussed in An Overview of Inserting, Updating, and Deleting, this causes the Grid View to add a Command Field with its .As we'll see in this tutorial, these statements can be created manually or can be automatically generated by the Sql Data Source s Configure Data Source wizard.Note Since we ve already discussed the inserting, editing, and deleting capabilities of the Grid View, Details View, and Form View controls, this tutorial will focus on configuring the Sql Data Source control to support these operations.Figure 5: Clicking the Delete Button in the Grid View Invokes the Sql Data Source s SQL statements can be specified through the Properties window or the control s declarative syntax.However, this approach requires that we manually write out the SQL statements by hand, which can be monotonous and error-prone.
To illustrate this, let s take an example from the table and a Grid View that renders this data.