The business object is assumed to update data one record at a time, rather than in a batch.
Before the Update operation is performed, the OnUpdating method is called to raise the Updating event. You can handle the Updating event to examine the values of the parameters and to perform any preprocessing before an Update operation. To perform an update operation, the ObjectDataSourceView object uses reflection to create an instance of the object that is identified by the TypeName property. It then calls the method that is identified by the UpdateMethod property, using any associated UpdateParameters properties. After the Update operation completes, the OnUpdated method is called to raise the Updated event. You can handle the Updated event to examine any return values, output parameters, and exceptions, and to perform any post-processing.
The Update method delegates to the Update method of the ObjectDataSourceView that is associated with the ObjectDataSource control.
For more information about parameter merging, object lifetime, and method resolution, see UpdateMethod.
Security Note: |
|---|
You should validate any parameter value that you receive from the client. The runtime simply substitutes the parameter value into the UpdateMethod property. |
Data-Bound Controls
When the ObjectDataSource control is associated with a data-bound control, such as the GridView control, it is not necessary to call the Update method from page code. The Update method is invoked directly by the data-bound control instead.