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.
To perform one of these operations, set the Command Name property of a button to one of the values in the following table. Sets the Command Argument property of the button to "First", "Last", "Next", "Prev", or a page number to specify the type of paging operation to perform.
Raises the Page Index Changing and Page Index Changed events.
This enables you to provide an event-handling method that performs a custom routine, such as modifying the values of the data bound to the row, whenever this event occurs.
A Grid View Row Event Args object is passed to the event-handling method, which enables you to access the properties of the row being bound.
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.
A Grid View Delete Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the delete operation should be canceled.
To cancel the delete operation, set the event to cancel the delete operation.