Gets or sets the name of a class that the ObjectDataSource control uses for a parameter in an update, insert, or delete data operation, instead of passing individual values from the data-bound control.
Assembly: System.Web (in System.Web.dll)
Instead of specifying several parameters that are passed to the Update, Insert, and Delete methods, you can create one object that aggregates several data field values. This one object is passed to the methods, instead of several parameters.
The default behavior of an ObjectDataSource control that is bound to a data-bound control is that the data-bound control creates a Parameter object for each parameter in the data source. If the business object has many fields, the resulting method also has many fields. The property allows you to specify a type that has a property for each data field. Then, instead of passing several parameters to the method, the runtime creates one object and sets all of its properties. This one object is added to the parameters collection for the method call.
The type that is specified by the property must have a default constructor that has no parameters, so the ObjectDataSource control can create an instance of the type. The type must also have settable properties that allow the ObjectDataSource control to populate the object with values that are passed from the data-bound control. The property names on the ObjectDataSource control are expected to exactly match the parameter names of values that are passed by the data-bound control.
When the property is set and the ObjectDataSource control is associated with a data-bound control, the methods that are specified by the InsertMethod and DeleteMethod properties must each have one parameter of the type that is specified in the property. If the ConflictDetection property is set to the OverwriteChanges value, the method that is specified by the UpdateMethod property must have one parameter of the type that is specified in the property. If the ConflictDetection property is set to the CompareAllValues value, the method that is specified by the UpdateMethod property must have two parameters of the type that is specified in the property. The first parameter contains the original values; the second parameter contains the new values.
The section contains two code examples. The first code example demonstrates how to implement a type that combines all parameter values into one object, using the property. The second code example shows the Web page that uses the two classes that are used in the first code example.
The following code example demonstrates how to implement a type that combines all parameter values into one object, using the property. The select method of the AggregateData class returns a DataTable object with two columns named Name and Number. Similarly, the NewData class defines two read/write properties, Name and Number. The Insert method of the AggregateData class takes one parameter of type NewData. The TypeName property of the ObjectDataSource is set to AggregateData and the property is set to NewData.
The following code example shows the Web page that uses the two classes that are used in the preceding code example.
Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.