asp.net.ph

Skip Navigation Links

Responding to Control Events in DetailsView Rows

Controls You Can Use on Web Forms   ASP.NET Data Controls   DetailsView Control


The DetailsView control provides several events that you can program against. This allows you to run a custom routine whenever an event occurs. The following table lists the events supported by the DetailsView control.

Event Description
ItemCommand Occurs when a button within a DetailsView control is clicked. This event is often used to perform a task when a button is clicked in the control.
ItemCreated Occurs after all DetailsViewRow objects are created in the DetailsView control. This event is often used to modify the values of a record before it is displayed.
ItemDeleted Occurs when a Delete button ( a button with its CommandName property set to "Delete" ) is clicked, but after the DetailsView control deletes the record from the data source. This event is often used to check the results of the delete operation.
ItemDeleting Occurs when a Delete button is clicked, but before the DetailsView control deletes the record from the data source. This event is often used to cancel the delete operation.
ItemInserted Occurs when an Insert button ( a button with its CommandName property set to "Insert" ) is clicked, but after the DetailsView control inserts the record. This event is often used to check the results of the insert operation.
ItemInserting Occurs when an Insert button is clicked, but before the DetailsView control inserts the record. This event is often used to cancel the insert operation.
ItemUpdated Occurs when an Update button ( a button with its CommandName property set to "Update" ) is clicked, but after the DetailsView control updates the row. This event is often used to check the results of the update operation.
ItemUpdating Occurs when an Update button is clicked, but before the DetailsView control updates the record. This event is often used to cancel the update operation.
ModeChanged Occurs after the DetailsView control changes modes ( to edit, insert, or read-only mode ). This event is often used to perform a task when the DetailsView control changes modes.
ModeChanging Occurs before the DetailsView control changes modes ( to edit, insert, or read-only mode ). This event is often used to cancel a mode change.
PageIndexChanged Occurs when one of the pager buttons is clicked, but after the DetailsView control handles the paging operation. This event is commonly used when you need to perform a task after the user navigates to a different record in the control.
PageIndexChanging Occurs when one of the pager buttons is clicked, but before the DetailsView control handles the paging operation. This event is often used to cancel the paging operation.

See Also

Introduction to the DetailsView Control   Adding DetailsView Controls to a Web Forms Page   Web Forms Events and Handlers



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note