Gets the parameters collection that contains the parameters that are used by the InsertMethod method.
Assembly: System.Web (in System.Web.dll)
The names and types of the parameters that are contained in the collection must match the names and types of the parameters that are in the method specified by the InsertMethod property signature. When working with data-bound controls that supply parameters, such as GridView and DetailsView, the ObjectDataSource control automatically merges any parameters that are explicitly specified in the collection with those parameters that are provided by the data-bound control. For more information, see InsertMethod.
This section contains two code examples. The first code example demonstrates how to display filtered data using an ObjectDataSource control with a business object and a DetailsView control to insert data. The second code example provides an example implementation of the Insert method that is used in the first code example.
The following code example demonstrates how to use an ObjectDataSource control with a business object and a DetailsView control to insert data. The DetailsView initially displays a new NorthwindEmployee record, along with an automatically generated Insert button. After you enter data into the fields of the DetailsView control, click the Insert button. The InsertMethod property identifies which method performs the Insert operation.
If you click the Insert button, the Insert operation is performed using the method that is specified by the InsertMethod property and any parameters that are specified in the collection. In this code example, one parameter is specified in the collection that corresponds to the supervisor's ID. This is because even though the ID is displayed in the Fields collection for the DetailsView control as a BoundField object, it will be passed as a string to the ObjectDataSource control. By adding it explicitly to the collection with a Type property that is set to the Int32 value, it will be passed correctly by the ObjectDataSource to the method as an int, not as string.
When the Insert operation is performed, the method that is identified by the InsertMethod property is called. If the Insert method of the object has a method signature that includes parameters, the collection must contain a parameter with names that match the method signature parameters for the Insert to complete successfully.
The following code example provides an example implementation of the Insert method that the preceding code example uses. The InsertNewEmployeeWrapper method is added to the EmployeeLogic middle-tier object to enable the object to work more easily with the ObjectDataSource control in Web scenarios, without a substantial rewrite to the actual business logic.