Skip to Content
0

Filtering data table programatically {C#}

Nov 08, 2016 at 04:35 PM

196

avatar image

C# SAP B1

Hi, so I have a grid on my own form. This grid have a data table and one of the column contains checkbox. Based on this checkbox there are further operation performed on this data.

I would like that user would be able to filter this table, so he can select just the rows which have desired properties (column's values). And for that I give the button which is enabling and disabling all the columns (because only then you can use filtering). After clicking this button user may use sap builded in function to filtering (from menu above).

So when the user is going to filter all data. Then in the grid there are visible just rows of specified properties, but in data table there are all.

Here is coming another functionality which is checking all checkboxes (or unchecking) after user clicked header of column. And here is problem as well, because data table contains all the rows, also those which are hidden by filtering, so which should not be checked.

How can I distinguish which rows are visible after filtering ?

How can I programatically get a list of visible rows after filtering ?

How may I at least now if the filtering have been applied ? This is problem because grid.Rows.Count as well dataTable.Rows.Count have a number of the whole data table collection, not just visible rows.

Please let me any hint. I hope my problem is clear, please let me know if I can specify more details or something is not straight clear.

In normal way I was using dataTable.SerializeAsXml() function and then as XDocument I was settings nodes and finally I could use dataTable.LoadSerializedXml() to fill grid with updated values. This is fast method. However I can't distinguish if I am filling hidden or visible row.

Regards,
Dariusz Gaweł

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers