If the last name is "Beaver", the delete operation is canceled, and an error message is displayed.
For any other name, the delete operation proceeds and the row is deleted. Rows are deleted from the Customer Address table instead of the Customer table in order to keep the example simple.
The page contains a Grid View control that displays a list of customer names and addresses from the Adventure Works LT database.
When the user clicks the Delete link for a row, the handler for the event checks the last name of the person displayed in the row that the user is trying to delete.
Now from the smart tag of the Grid View choose “Edit Template” and then select “Edit Item Template” of Company Name column.
This will display the template designer for the column as shown in Figure 6.
The Grid View control shows the result of joining three tables: Customer, Address, and Customer Address.
When a Customer Address row is deleted, the corresponding Grid View row disappears.
event is raised when a row's Delete button is clicked, but before the Grid View control deletes the row.
This enables you to provide an event-handling method that performs a custom routine, such as canceling the delete operation, whenever this event occurs.
In order to do so select “Edit Columns…” from the smart tag of the Grid View. Select Company Name and Contact Name fields and click on “Covert this field into a Template Field” link.