After completing the page listing the records (see Creating delete links on the search page (ASP.NET)), switch to the delete confirmation page. The confirmation page shows the record and asks the user if theyre sure they want to delete it. When the user confirms the operation by clicking the form button, the web application deletes the record from the database.
Building this page consists of the following tasks:
Retrieving and displaying the record consists of defining a DataSet to hold a single record--the record the user wants to delete--and binding the DataSet columns to the page. The steps are outlined in more detail below.
You specified a confirmation page when you created the Delete links in the previous section. Use this name when saving the file for the first time (for example, locationDelete.aspx).
The hidden form field is required to store the record ID passed by the URL parameter. To add a hidden field, place the insertion point in the form and select Insert > Form > Hidden Field.
The user will click the button to confirm and delete the displayed record. To add a button, place the insertion point in the form and select Insert > Form > Button.
The simple DataSet dialog box appears. If the advanced DataSet dialog box appears instead, click Simple to switch to the simple DataSet dialog box.
To display only some of the records fields, click Selected and select the desired fields by Control-clicking (Windows) or Command-clicking (Macintosh) them in the list.
Make sure to include the record ID field even if you wont be displaying it.
For example, if the URL used to open the confirmation page included the suffix locationDelete.aspx?recordID=CBR, then enter recordID.
The DataSet dialog box should look as follows.
The DataSet appears in the Bindings panel.
Make sure you insert this read-only dynamic content within the form boundaries. For more information on inserting dynamic content in pages, see Making text dynamic.
Next, you must bind the record ID column to the hidden form field.
The hidden form field is selected.
The Dynamic Data dialog box appears.
In the following example, the record ID column selected is CODE.
The completed confirmation page should look as follows.
After creating a confirmation page, the next step is to add logic to delete the record. See Adding logic to delete the record (ASP.NET).