FormView Web Server Control Events
The FormView control raises a number of events in the course of paging through and updating its bound data to which your code can respond.
For an example that uses some of the FormView control events, see Modifying Data Using a FormView Web Server Control.
FormView Events
The FormView control raises events that occur when the current record displayed or changed. Events are also raised when a command control such as a Button that is part of the FormView control has been clicked. The following table describes the events exposed by the FormView control.
PageIndexChanging
Occurs when one of the pager buttons is clicked, but before the FormView control performs the paging operation. This event is often handled to cancel the paging operation.PageIndexChanged
Occurs when one of the pager buttons is clicked, but after the FormView control performs the paging operation. This event is commonly handled when you need to perform a task after the user navigates to a different record in the control.ItemCommand
Occurs when a button within a FormView control is clicked. This event is often handled to perform a task when a button is clicked in the control.ItemCreated
Occurs after all FormViewRow objects are created in the FormView control. This event is often handled to modify the values to be displayed in a row before the row is displayed.ItemDeleting
Occurs when a Delete button (a button with its CommandName property set to "Delete") is clicked, but before the FormView control deletes the record from the data source. This event is often used to cancel the delete operation.ItemDeleted
Occurs when a Delete button is clicked, but after the FormView control deletes the record from the data source. This event is often handled to check the results of the delete operation.ItemInserting
Occurs when an Insert button (a button with its CommandName property set to "Insert") is clicked, but before the FormView control inserts the record. This event is often handled to cancel the insert operation.ItemInserted
Occurs when an Insert button is clicked, but after the FormView control inserts the record. This event is often handled to check the results of the insert operation.ItemUpdating
Occurs when an Update button (a button with its CommandName property set to "Update") is clicked, but before the FormView control updates the record. This event is often used to cancel the update operation.ItemUpdated
Occurs when an Update button is clicked, but after the FormView control updates the row. This event is often used to check the results of the update operation.ModeChanging
Occurs before the FormView control changes modes (to edit, insert, or read-only mode). This event is often handled to cancel a mode change.ModeChanged
Occurs after the FormView control changes modes (to edit, insert, or read-only mode). This event is often handled to perform a task when the FormView control changes modes.DataBound
This event is inherited from the BaseDataBoundControl control and occurs after the FormView control has finished binding to the data source.
See Also
Concepts
FormView Web Server Control Overview