ADAdministrator Syncfusion Team October 5, 2004 10:08 AM
The grid does have support for a Find/Replace mechanism, but you do have to add code to your project to get this working. There is no built-in Find method. Here is a forum thread with a sample in it.
Using this technique, the grid is accessing the data in a manner that is firing events. This event processing may slow things down if you have large grids.
Here is another sample. It implements a fast FindAll. In this sample, a GridDataBoundGrid with 20000 rows can return all occurrences of a string in less than 100 msecs on my system. It does so by copying the column to an arraylist, and using ArrayList.IndexOf to do the searching. Now in my simple implementation, this requires a full word match. If you wanted more flexibility, instead adding the strings directly to the ArrayList, you could wrap them in an object that has its own Equals method to do whatever custom matching you wanted to do. I suspect this would still be quick.
The sample shows both a GridControl and a GridDataBoundGrid. You can set the number of rows, and also whether you want to use the Fast technique or the GridFindReplaceDialogSink technique. Again, it only finds exact matches.
IRIrinaOctober 6, 2004 05:36 AM
I use your sample #2 with GridFindReplaceDialogSink technique. The only problem is that in your sample when I click ''Find again'' button it finds all strings except the first occurrence of the text which is at row0. When the first occurrence of the text is at row1 – it is okay. Probably because of that, in my GDBG where I have set ListBoxSelectionMode.One it highlights any found row except the case when the found row is the first row. The triangle is on the first row, but it is not highlighted. So to work around the problem I try to check find result:
object o = fr.Find(fre);
if (o == null)
But how to fix the problem and be able to find the first row as well?
ADAdministrator Syncfusion Team October 6, 2004 06:34 AM
Here is a thread that includes a work around for this problem.