# Search Panel

The Grid component has built-in search functionality that you can use through either the SmartBox Search mode or the Search Panel in the toolbar. Both options rely on Grid filtering to show only the relevant records.

## SmartBox Search

The Grid search functionality is available in the [AI Smart Box](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/smart-grid/ai-toolbar-tool). The Smart Box Search mode uses the same Grid `Search` configuration, including `Search.fields` and field operators.

To enable it, add the Smart Box tool to the Grid toolbar and configure the `SmartBox.SearchSettings` option.

```Razor HtmlHelper
    @(Html.Kendo().Grid<CustomerViewModel>()
        .Name("grid")
        .ToolBar(toolbar => toolbar.SmartBox())
        .Search(search =>
        {
            search.Field(c => c.ContactName, "contains");
            search.Field(c => c.Age, "eq");
        })
        .SmartBox(sb => sb
            .ActiveMode(SmartBoxActiveMode.Search)
            .SearchSettings(s => s.Enabled(true))
        )
        ...
    )
```

For additional Smart Box search capabilities, such as Semantic Search mode, refer to [Semantic Search](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/smart-grid/semantic-search).

## Search Panel

> Search Panel functionality is available as of [Kendo UI R3 2019](https://www.telerik.com/support/whats-new/kendo-ui/release-history/kendo-ui-r3-2019) release.

### Getting Started

To enable the functionality, include the `Search` option in the toolbar configuration.

You can also customize which fields are searched when users enter a value in the search input.

```Razor HtmlHelper
    @(Html.Kendo().Grid<CustomerViewModel>()
        .Name("grid")
        .ToolBar(t => t.Search())
        .Search(s =>
        {
            s.Field(c => c.ContactTitle);
        })
        ...
    )
```

## Specify the Filter Operator

As of Kendo UI 2021 R3 SP1, you can specify filter operators for each filter type. With this update, you can filter non-string types.

The following example demonstrates how to specify which fields to include in the search.

```Razor HtmlHelper
    @(Html.Kendo().Grid<CustomerViewModel>()
        .Name("grid")
        .ToolBar(t => t.Search())
        .Search(s =>
        {
            s.Field(c => c.ContactName);
            s.Field(c => c.Age);
        })
        ...
    )
```

The following example demonstrates how to specify the operator for the field that will be used in the filter expression.

```Razor HtmlHelper
    @(Html.Kendo().Grid<CustomerViewModel>()
        .Name("grid")
        .ToolBar(t => t.Search())
        .Search(s =>
        {
            s.Field(c => c.ContactName, "contains");
            s.Field(c => c.Age, "eq");
        })
        ...
    )
```

## Known Limitations

* When filtering is enabled, the filter textboxes for all Grid columns will be populated with the value entered in the search textbox.

## See Also

* [Search Panel in the Telerik UI Grid (Demo)](https://demos.telerik.com/aspnet-mvc/grid/search-panel)

* [Server-Side API](https://www.telerik.com/aspnet-mvc/documentation/api/grid)

* [AI Smart Box](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/smart-grid/ai-toolbar-tool)

* [Smart Grid Overview](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/data-management/grid/smart-grid)

* [Knowledge Base Section](https://www.telerik.com/aspnet-mvc/documentation/knowledge-base)
