Export (0) Print
Expand All

LinqDataSource::WhereParameters Property

Gets the collection of parameters that is used to create the Where clause.

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

[BrowsableAttribute(false)]
[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
public:
virtual property ParameterCollection^ WhereParameters {
	ParameterCollection^ get () sealed;
}

Property Value

Type: System.Web.UI.WebControls::ParameterCollection
A collection of the parameters that are used to create the Where clause in the Where property.

Implements

IDynamicDataSource::WhereParameters

The LinqDataSource control uses parameters in the WhereParameters collection to create the Where clause at run time. You add parameters to the WhereParameters collection when you want to programmatically set one or more of the conditions in the Where clause. For example, you might search a database table for records with a last name equal to the value of a TextBox control. In that case, you add a parameter to the WhereParameters collection for the text box value.

If you do not have to set a value at run time in the Where clause, you do not have to use the WhereParameters collection. You can define the fields to retrieve in the Where property. For example, to return values from a database table where LastName equals "Adams" in markup, set the Where property to 'LastName = "Adams"' without any parameters.

To set values in the WhereParameters collection, you assign a name to each parameter and then add a placeholder in the Where property for that parameter. In the Where clause, preface each parameter name with the @ symbol.

The following example shows how to use the WhereParameters collection to dynamically create the Where clause. The LinqDataSource control returns all the records with a value in the Price column that is greater than the value selected by the user in a DropDownList control.

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

.NET Framework

Supported in: 4.5, 4, 3.5

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.

Show:
© 2014 Microsoft