LinqDataSource::InsertParameters Property


Gets the collection of parameters that are used during an insert operation.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web.Extensions (in System.Web.Extensions.dll)

property ParameterCollection^ InsertParameters {
	ParameterCollection^ get();

Property Value

Type: System.Web.UI.WebControls::ParameterCollection^

The parameters that are used during an insert operation.

Typically the values that are needed for an insert operation are passed to the LinqDataSource control by the data-bound control. You specify insert parameters when you want to provide a default value or define whether to convert empty values to null. You do not have to provide a parameter for every value that will be inserted, only for the values that must be handled when the user does not provide a value.

The values that you provide in the InsertParameters collection are used only for fields that are defined in the data source but that are not bound in the data control. For example, suppose a database table has columns that are named Name, Address, and PostalCode, but a ListView control that is bound to the table is bound only to the Name and Address fields. The values in the InsertParameters collection will be used only for the PostalCode field. They will not be used for the Name and Address field. This is true even if no value is entered for those fields. If the data-bound control autogenerates fields for all fields in the data source, no values from the InsertParameters collection will be used.

The following example shows a LinqDataSource control with a parameter that provides a default value in the InsertParameters collection. If the user does not provide a value for the Category property, the default value that is provided by the parameter is saved in the database.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top