Hello,
You may use C1TrueDBGrid only.
Please refer to the following blog post wherein it has been discussed how one can implement Filtering & Sorting in C1TrueDBGrid bound to business objects :
You would have to handle the Filtering mechanism manually.
In this post, filtering is being handled on a button click.
Please refer to the modified sample wherein I have shown it using the default FilterBar (for this you need to handle the FilterChange event of the Grid).
Here is what you can do :
//Filtering using FilterBar private void c1TrueDBGrid1_FilterChange(object sender, EventArgs e) { //Create a new list object; to be populated with filtered values. List<MyPerson> p = new List<MyPerson>(); foreach (C1.Win.C1TrueDBGrid.C1DataColumn dc in c1TrueDBGrid1.Columns) { if (dc.FilterText.Length > 0) { try { if (c1TrueDBGrid1.Columns[c1TrueDBGrid1.Columns.IndexOf(dc)].Caption == "ID") { p = people.FindAll(delegate(MyPerson mp) { return (mp.ID == int.Parse(dc.FilterText)); }); } else if (c1TrueDBGrid1.Columns[c1TrueDBGrid1.Columns.IndexOf(dc)].Caption == "Name") { p = people.FindAll(delegate(MyPerson mp) { return (mp.Name.StartsWith(dc.FilterText,StringComparison.InvariantCultureIgnoreCase)); }); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } //bind the grid to the actual list object if filterbar is empty. if (p.Count == 0) { c1TrueDBGrid1.SetDataBinding(people, "", true); } //else bind the grid to the new list object containing filtered values. else { c1TrueDBGrid1.SetDataBinding(p, "", true); } }
Let me know if this works for you or not.
Regards,
Reema