4
votes

I am trying to dynamically add grid filters in my view using the html helper via datasource configuration, like this example from the kendo documentation:

@(Html.Kendo().Grid<Product>()
    .Name("grid")
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("Products_Read", "Home"))
        .Filter(filters =>
        {
            if (someCondition){
               // Show products whose ProductName property contains "C"
               filters.Add(product => product.ProductName).Contains("C");
               // and UnitsInStock is greater than 10
               filters.Add(product => product.UnitsInStock).IsGreaterThan(10);
            }
        })
    )
)

The filters are added, but the filterdescriptor.Value in each case is always null (the Member and Operator are fine).

Any help much appreciated. Thanks! --Berry

1

1 Answers

4
votes

Make sure you have included kendo.aspnetmvc.min.js. Missing it would lead to similar symptoms.