This documentation is archived and is not being maintained.

LinqDataSource.InsertParameters Property

Updated: February 2010

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)

public ParameterCollection InsertParameters { 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.

      <asp:Parameter Name="Category" DefaultValue="Miscellaneous" />
      <asp:Parameter Name="Category" DefaultValue="Miscellaneous" />

Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5




February 2010

Provided additional explanation of how to use this collection.

Customer feedback.