In the previous section, you have seen several examples of data control events. The events for the data control are provided to you at the appropriate time of the page execution lifecycle for you to insert custom code. In general, data controls expose events before and after a particular operation occurs. The name of an event that is invoked before an operation typically has a-ing suffix, and the name of the event that is invoked after an operation typically has a-ed suffix. For example, the events supported by the GridView include:
· Pageindexchanging and PageIndexChanged-raised before and after paging operations
· Selectedindexchanging and SelectedIndexChanged-raised before and after the selection operation occurs
· Sorting and sorted-raised before and after the sort operation
· Rowediting and Rowcancelingedit-raised before the data row enters edit mode or when edit mode is terminated
· RowUpdating and RowUpdated-raised before and after the update operation
· RowDeleting and rowdeleted-raised before and after the delete operation
· RowDataBound-When data rows are data-bound, raised
· RowCreated-raises when data rows are established and displayed
· Rowcommand-invokes the internal control's button command when the
Data source controls also expose events similar to events in data-bound controls. The SqlDataSource and ObjectDataSource controls support the following events:
· Selecting and selected-raised before and after the selection operation
· Updating and updated-raised before and after the update operation
· Deleting and deleted-raised before and after the delete operation
· Inserting and inserted-raised before and after the insert operation
· Filtering-raises before the filter operation occurs
It also provides additional events when the object specified by the TypeName property of the ObjectDataSource control is created or destroyed. You can set the custom object in the ObjectCreating event by setting the ObjectInstance property that is passed with the event arguments.
· ObjectCreating and objectcreated-raised before and after the object is built
· Objectdisposing-Raised before object is destroyed