Configure Where Expression - LinqDataSource

The Configure Where Expression dialog box enables you to define conditions that must be true for a record to be returned by a LinqDataSource control. Those conditions are dynamically generated as part of the Where clause of a LINQ query.

You can add one or more search conditions to a Where clause. For each search condition, you can specify either a literal or a parameterized value. Parameterized values enable you to bind to application variables, user properties, control values, and other data. For more information about how to set the Where clause, see the Where property.

You access the Configure Where Expression dialog box by clicking the Where button in the Configure Data Source - LinqDataSource dialog box when the AutoGenerateWhereClause property is false. If you set the AutoGenerateWhereClause property to true, the Where button displays the Expression Editor dialog box. This is because you cannot set the Where clause and have the LinqDataSource control generate the Where clause.

Column

Specifies which property to use in the Where clause. The value selected from the drop-down list becomes the left side of the search condition.

Operator

Specifies which operator to use in the Where clause condition.

Source

Specifies which source to use in the Where clause search condition. The selected source becomes the right side of the search condition. The choices are None, Control, Cookie, Form, Profile, QueryString, and Session.

Each source results in a different Parameter control in the WhereParameters collection of the LinqDataSource control, as shown in the following table:

For more information, see Using Parameters with Data Source Controls.

Selecting None indicates that a literal value will be used in the search condition. In that case, the Parameter Properties element shows only a Value field.

Selecting any one of the other Source values indicates that a parameterized value will be used in the search condition. In that case, the Parameter Properties element shows two fields.

Parameter Properties

Specifies the parameter properties of the search condition. What appears in the Parameter Properties element depends on which value that you selected for Source, as shown in the following table:

Source

Parameter properties

None

Value

Control

Control ID

Default value

Cookie

Cookie name

Default value

Form

Form field

Default value

Profile

Property name

Default value

QueryString

QueryString field

Default value

Session

Session field

Default value

Expression

Displays the syntax of the Where clause that is currently being configured.

Value

Displays the value that will be used as the parameter.

Preview

Displays all the search conditions for the Where clause.

Add

Adds the configured search condition to the Where clause. The Add button is enabled only if the search condition is fully specified.

Remove

Removes the selected search condition in the Preview element. The Remove button is enabled only if the Where clause contains at least one search condition.

Community Additions

ADD
Show: