Expression Editor - LinqDataSource
The Expression Editor dialog box enables you to set the Where, Order By, Group By, or Select expressions for a LinqDataSource control. You can add parameters that are used in these expressions. When setting the Where or Order By expression, you can let the LinqDataSource control automatically generate the expression, or you can manually create the expression. The Expression Editor dialog box also enables you to add parameters for Insert, Update, or Delete operations.
You access this dialog box by selecting the ellipsis button (…) in the Properties window for any one of the following:
Where property
OrderBy property
GroupBy property
Select property
Delete method
Insert method
Update method.
The user interface in the Expression Editor changes, depending on which expression you set. For example, the element for manually setting the expression is named Where Expression or Order By Expression, depending on the context.
You also access this dialog box by clicking the Where or Order By button in the Configure Data Source - LinqDataSource dialog box when you have already set the LinqDataSource control to automatically generate the expression. It is also displayed if you have previously set the expression to a custom expression that cannot be supported through the other dialog boxes. You set the AutoGenerateWhereClause property to true to automatically generate the Where clause. You set the AutoGenerateOrderByClause property to true to automatically generate the Order By clause.
Automatically generate the expression based on the provided parameters
Specifies whether the LinqDataSource control generates the Where or Order By expression. The generated expression includes the parameters that are defined in the WhereParameters collection or the OrderByParameters collection. For information about how the LinqDataSource control generates the expression, see the AutoGenerateWhereClause property or the AutoGenerateOrderByClause property.Expression
Enables you to manually create the Where, Order By, Group By, or Select expression. When you set the Where or Order By expression and the Automatically generate the expression based on the provided parameters check box is selected, this element is disabled. If you select the check box, any expression that you enter will be cleared. For more information about how to set the Where or Order By expression, see the Where property or the OrderBy property.Parameters
Displays existing parameters and lets you add new parameters. The table shows the name of the parameter and the syntax that is used to retrieve the parameter value. Click Add Parameter to add a new parameter.Parameter source
Specifies which source to use for a parameter. The choices are None, Control, Cookie, Form, Profile, QueryString, and Session.Each source results in a different Parameter control in the parameter collection of the LinqDataSource control, as shown in the following table:
Source
Resulting Parameter
None
Control
Cookie
Form
Field
QueryString
Session
For more information, see Using Parameters with Data Source Controls.
The source that you select determines which fields are available for defining the parameter, as shown in the following table:
Parameter 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