New to Telerik UI for ASP.NET CoreStart a free 30-day trial

Localization

The Filter provides options for defining the text of its filter operators (for example, contains, equals, or greater than) and logic messages (for example, AND and OR).

To localize the messages, set the desired strings in the .Operators() and .Messages() options. You can also use this feature to select the available filter operators.

Razor
<script type="text/x-kendo-template" id="itemTemplate">
    <li>
        <strong>#= Name #</strong>, aged #= Age #, is on vacation: #= IsOnLeave #
    </li>
</script>

@(Html.Kendo().DataSource<SampleData>()
    .Name("dataSource1")
    .Ajax(d=>d.Read(r => r.Action("GetPeople", "Filter")))
)

@(Html.Kendo().Filter<SampleData>()
    .Name("filter")

    .Messages(m => // Custom texts for localizable UI.
    {
        m.And("AND"); // The AND main logic text.
        m.Or("OR"); // The OR main logic text.
        m.Apply("Set Filter"); // The APPLY button text.
    })

    .Operators(o => // Define the custom texts for the operator names and select the available operators.
    {
        o.String(s =>
        {
            s.Eq("Is Exactly");
            s.Contains("Partially Matches");
        });
        o.Number(n =>
        {
            n.Gte("Older Than");
            n.Lt("Younger Than");
        });
    })

    .MainLogic(FilterCompositionLogicalOperator.And)
    .ExpressionPreview() // Shows a text preview of the filter expression.
    .ApplyButton() // Shows the built-in Apply button.
    .Fields(f => // Defining the fields is not mandatory. Otherwise, they will be taken from the data source schema.
                    // If you define the fields, their names and types must match the data source definition.
    {
        f.Add(p=>p.Name).Label("Name");
        f.Add(p=>p.Age).Label("Age");
        f.Add(p=>p.IsOnLeave).Label("On Vacation");
    })
    .FilterExpression(f => { // Defining an initial filter expression is not required.
        f.Add(p => p.Age).IsGreaterThanOrEqualTo(30);
        f.Add(p => p.Name).Contains("Doe");
    })
    .DataSource("dataSource1")
)

@(Html.Kendo().ListView<SampleData>()
    .Name("listView")
    .TagName("ul")
    .DataSource("dataSource1")
    .ClientTemplateId("itemTemplate")
)

<script>
    $(document).ready(function () {
        // Apply filtering immediately after the helper initialization because an initial filter is set.
        $("#filter").getKendoFilter().applyFilter();
    });
</script>

See Also

In this article
See Also
Not finding the help you need?
Contact Support