asp.net.ph

Skip Navigation Links

Responding to Control Events in DataGrid Items

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


The DataGrid 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 DataGrid control.

Event Description
CancelCommand Occurs when the Cancel button is clicked for an item in the DataGrid control.
DeleteCommand Occurs when the Delete button is clicked for an item in the DataGrid control.
EditCommand Occurs when the Edit button is clicked for an item in the DataGrid control.
ItemCommand Occurs when a button is clicked in the DataGrid control. This event is often used to perform a task when a button is clicked in the control.
ItemCreated Occurs when a new item is created in the DataGrid control. This event is often used to modify the contents of a item when the item is created.
ItemDataBound Occurs when a data item is bound to data in the DataGrid control. This event is often used to modify the contents of a item when the item is bound to data.
PageIndexChanged Occurs when one of the page selection elements is clicked.
SelectedIndexChanged Occurs when the Select button is clicked for an item other than the current item in the DataGrid control.
SortCommand Occurs when a column is sorted.
UpdateCommand Occurs when the Update button is clicked for an item in the DataGrid control.

See Also

Introduction to the DataGrid Control   Adding DataGrid 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