Back to Devexpress

SearchControl.QueryIsSearchColumn Event

windowsforms-devexpress-dot-xtraeditors-dot-searchcontrol-b195523d.md

latest4.3 KB
Original Source

SearchControl.QueryIsSearchColumn Event

Allows you to specify columns in the attached data control where the SearchControl should search for data.

Namespace : DevExpress.XtraEditors

Assembly : DevExpress.XtraEditors.v25.2.dll

NuGet Package : DevExpress.Win.Navigation

Declaration

csharp
[DXCategory("Events")]
public event QueryIsSearchColumnEventHandler QueryIsSearchColumn
vb
<DXCategory("Events")>
Public Event QueryIsSearchColumn As QueryIsSearchColumnEventHandler

Event Data

The QueryIsSearchColumn event's data class is QueryIsSearchColumnEventArgs. The following properties provide information specific to this event:

PropertyDescription
CaptionGets the processed column’s caption.
DataTypeGets the processed field’s data type.
FieldNameGets the processed field’s name.
IsSearchColumnGets or sets whether to search in the processed column.

Remarks

The SearchControl searches through all columns in the attached control (see RepositoryItemSearchControl.Client).

The QueryIsSearchColumn event allows you to specify whether or not to search in a specific column. The control raises this event for each column in the attached control. Read the Caption event argument to obtain the processed column’s caption. You can also use the FieldName and DataType arguments to obtain the processed field’s name and data type. If the SearchControl should not be permitted to search in the processed column, set the IsSearchColumn event argument to false.

The SearchControl.QueryIsSearchColumn and RepositoryItemSearchControl.QueryIsSearchColumn (see SearchControl.Properties) events are equivalent.

Example

The code below shows how to search in the Ship Country column only.

csharp
using DevExpress.XtraEditors;

private void searchControl1_QueryIsSearchColumn(object sender, QueryIsSearchColumnEventArgs args) {
    if (args.FieldName != "ShipCountry")
        args.IsSearchColumn = false;    
}
vb
Imports DevExpress.XtraEditors

Private Sub SearchControl1_QueryIsSearchColumn(sender As Object, args As QueryIsSearchColumnEventArgs) _
    Handles SearchControl1.QueryIsSearchColumn
    If args.FieldName <> "ShipCountry" Then
        args.IsSearchColumn = False
    End If
End Sub

See Also

QueryIsSearchColumn

SearchControl Class

SearchControl Members

DevExpress.XtraEditors Namespace