Figure 2: Select the Delete Query Property from the Properties Window provide a value for this parameter (leave its Parameter source at None ).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 .An Overview of Inserting, Updating, and Deleting examined using the Object Data Source to facilitate inserting, updating, and deleting with the Grid View, Details View, and Form View controls.
Refer to the Adding Validation Controls to the Editing and Inserting Interfaces and Customizing the Data Modification Interface tutorials for more information. Then, after completing the wizard, choose to configure the Select Query from the Properties window (or, alternatively, go back to the Configure Data Source wizard, but use the Specify a custom SQL statement or stored procedure option). If such customizations are required, you need to make them manually, either through the Properties window, the Specify a custom SQL statement or stored procedure option in the wizard, or via the declarative syntax.When adding parameters that do not have corresponding fields in the data Web control, keep in mind that these parameters values will need to be assigned values in some manner.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.The results are then returned as either a Data Set or Data Reader, depending on the value of the control s value has been specified, the Enable Inserting, Enable Editing, or Enable Deleting option in the corresponding data Web control s smart tag will become available.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.For now, leave this checkbox unchecked; we'll examine optimistic concurrency with the Sql Data Source control in the next tutorial.After checking the Generate statements checkbox, click OK to return to the Configure Select Statement screen, then click Next, and then Finish, to complete the Configure Data Source wizard.To illustrate this, let s take an example from the table and a Grid View that renders this data.Our goal is to extend this example to allow for the user to delete products via the Grid View.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.