Hello!
I'm using __ultraGrid.DisplayLayout.Bands[0].ColumnFilters["KEYCOLUMN"].FilterConditions.Add(FilterComparisionOperator.Contains, "TextToSearch"); to filter the rows.
The question is: Can i highlight the text inside that matches the "TextToSearch"?
it should work like the office search
I don't think that there's any built-in mechanism for doing this. You could certainly loop through all the filtered in rows and modify the values themselves so that they will be highlighted. The best way to do this would to have the Style of the column set to FormattedText and do something like the following:
string filterVal = this.ultraGrid1.DisplayLayout.Bands[0].ColumnFilters["Col 1"].FilterConditions[0].CompareValue.ToString();foreach (UltraGridRow row in this.ultraGrid1.Rows.GetFilteredInNonGroupByRows()){ string replacement = String.Format("<span style=\"background-color:Yellow;\">{0}</span>", filterVal); string cellVal = row.Cells["Col 1"].Value.ToString(); cellVal = cellVal.Replace(filterVal, replacement); row.Cells["Col 1"].Value = cellVal;}
You would still have to make a decision as to when and how often you want to do this. For example, perhaps you don't want to loop through every row as a user types each character, so you may want to start a timer and wait a certain length of time before doing this. The other problem is how you would clear these values when the filter changes. I think that the easiest approach would be to hide the column that contains the real data and use an UnboundColumn to do the actual filtering on. This way, when the filter changes, you can get the original unmodified value from the hidden bound column and use the code above and you won't have to worry about manually parsing out and removing the <span> tags.
-Matt
well, it worked:).
Hope to see this fetaure in the next releases of the grid.
Thank you
Best regards
If you want to have this implemented as a feature, you should submit a feature request through Developer Support.