Export (0) Print
Expand All

SearchExpression.DataFields Property

Gets and sets a single field or a comma-separated list of fields to search.

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

member DataFields : string with get, set

Property Value

Type: System.String
The field or fields to search.

ExceptionCondition
InvalidOperationException

The DataFields property is a null reference (Nothing in Visual Basic).

The SearchExpression class performs the search in one or more data fields in the specified table. At least one data field must be specified in the SearchExpression instance. If you specify more than one data field, separate the fields by using a comma.

The following example shows how to search the Name and the ProductNumber data fields in the Products table of the AdventureWorks database for products that have names that start with a specified string. This code example is part of a larger example provided in Walkthrough: Filtering Data in a Web Page Using Declarative Syntax.

<asp:SearchExpression SearchType="StartsWith" 
      DataFields="Name","ProductNumber" >
  <asp:ControlParameter ControlID="SearchTextBox" />
</asp:SearchExpression>

.NET Framework

Supported in: 4.5.3, 4

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