We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Find row index by column value

Thread ID:

Created:

Updated:

Platform:

Replies:

19862 Oct 5,2004 10:52 AM Oct 6,2004 07:34 AM Windows Forms 3
loading
Tags: GridControl
Irina
Asked On October 5, 2004 10:52 AM

Hi Clay, I use databound grid and I want to highlight the row with the specific value of the column. Can I get the row index by the column value without looping through all rows? Thanks in advance

Administrator [Syncfusion]
Replied On October 5, 2004 11: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. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=14572 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.

Irina
Replied On October 6, 2004 06:36 AM

Hi Clay, 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) { this.gridDataBoundGrid1.Selections.Add(GridRangeInfo.Row(1)); } But how to fix the problem and be able to find the first row as well? Thanks.

Administrator [Syncfusion]
Replied On October 6, 2004 07:34 AM

Here is a thread that includes a work around for this problem. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=14572

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;