ObjectDataSource.Insert Method
Assembly: System.Web (in system.web.dll)
Before the Insert operation is performed, the OnInserting method is called to raise the Inserting event. You can handle the Inserting event to examine the values of the parameters and to perform any preprocessing before an Insert operation. To perform an insert 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 InsertMethod property, using any associated InsertParameters properties. After the Insert operation completes, the OnInserted method is called to raise the Inserted event. You can handle the Inserted event to examine any return values, output parameters, and exceptions, and to perform any post-processing.
Note: |
|---|
| If you are not familiar with the Data Access features in ASP.NET 2.0, you should read some of these topics before continuing: |
The Insert method delegates to the Insert method of the ObjectDataSourceView that is associated with the ObjectDataSource control.
For more information about parameter merging, object lifetime, and method resolution, see InsertMethod.
Data-Bound Controls
When the ObjectDataSource object is associated with a data-bound control, such as the GridView control, it is not necessary to call the Insert method from page code. The Insert method is invoked directly by the data-bound control instead.
Note: