Posted 9 August 2022, 11:28 am EST - Updated 3 October 2022, 10:18 pm EST
Filter with flexgrid
Posted by: levanduyet on 9 August 2022, 11:28 am EST
-
-
Posted 10 August 2022, 3:48 am EST
Hi,
you would have to do this yourself: loop over all rows and set visibility based on the filter.
Here is a sample code snippet:
private void FilterGrid (string text) { for (int row = this.c1FlexGrid.Rows.Fixed; row < this.c1FlexGrid.Rows.Count; row++) { //Get data of col "ItemCode" string itemcode = (string) this.c1FlexGrid[row, 2]; string itemdescription = (string) this.c1FlexGrid[row, 3]; this.c1FlexGrid.Rows[row].Visible = itemcode.Contains(text) || itemdescription.Contains(text); } }
Hope this helps
Wolfgang
-
Posted 10 August 2022, 5:21 am EST
Hi,
If you want to filter out the rows on the basis of searching the typed values in the textbox, you will need to do it manually by setting the Visible property of the non-matching rows to false (similar to what @Wolfgang suggested).
If you want to filter out the rows on the basis of the fixed/specific values in your columns, you can use the Filter property of your required columns to assign a Value Filter to them. Kindly refer to the attached sample showing the same.
PS: Thanks for the suggestion, @Wolfgang!
Best Regards,
Kartik -
Posted 11 June 2023, 2:48 am EST
Thanks,
Duyet Le