ComponentOne ASP.NET MVC Controls
Exclusive Value Search
Working with Controls > FlexGrid > Work with FlexGrid > Exclusive Value Search

FlexGrid offers an exclusive value search feature which enables Excel-like behavior wherein searching excludes items from the filter. It provides ExclusiveValueSearch property in ValueFilter class, which sets a value that determines whether the filter should only include values selected by the FilterText property. This property is of type Boolean and is set to true, by default, allowing the search to exclude items from the filter. If set to false, searching only affects which items are displayed on the list and not which items are included in the filter.

To include exclusive value search in FlexGrid, use the following code. In this example, we have created a model with Person type data that includes ID, Name, Country, First, Last and Sales properties.

IndexController.cs

C#
Copy Code
public static List<Person> Persons = SampleData.GetData().ToList();
        public ActionResult Index()
        {
            return View(Persons);
        }

Index.cshtml

cshtml
Copy Code
@(Html.C1().FlexGrid<Person>().Id("flexGrid")
      .Filterable(f => f.DefaultFilterType(FilterType.Both)
           .ColumnFilters(cfsb =>
            {
                  cfsb.Add(cfb => cfb.Column("First").FilterType(FilterType.Value).ValueFilter(vfb =>
                  {
                       vfb.ExclusiveValueSearch(true);
                   }));
             })
    )
    .Bind(m => m.Bind(Model)
)