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. Image for the cookie policy date

Find data in grid and highlight cell

Hello,
I am using Find & Replace Dialog to search on Grid control. It works OK, but I can not change highlighted cell style. It draws dotted border around hardly visible on the screen. I'd like to change back color for found cell, or at least make the border solid/colored. How can I do it?
Thanks,
Irina

8 Replies

JJ Jisha Joy Syncfusion Team March 12, 2010 09:07 AM UTC

Hi Irina,

You could refer the following sample from the sample browser to achieve the desired behavior.

C:\Syncfusion\8.1.0.30\Windows\Grid.Windows\Samples\2.0\MS Excel-Style Features\Grid Find-Replace Demo

Thank you for using Syncfusion products.

Regards,
Jisha


AD Administrator Syncfusion Team March 12, 2010 02:34 PM UTC

I am using version 4.402.0.51 so I do not have an access to these samples. Could you zip it for me or direct me to the appropriate sample for 4.4... version?


JJ Jisha Joy Syncfusion Team March 15, 2010 12:59 PM UTC

Hi Irina,

Please find the sample attached.

REgards,
Jisha



cs_c536e31.zip


AD Administrator Syncfusion Team March 15, 2010 06:18 PM UTC

I tried the sample you provided and it works fine, except that I can not set borders or back color for static read only cells. My grid has some read only columns, and I can find matchind data in these columns, however back color is not changed.
In the sample you provided i included code which makes 2nd column static read only:

for (int i = 1; i <= gridControl1.RowCount; i++)
{
gridControl1[i, 2].CellType = "Static";
gridControl1[i, 2].ReadOnly = true;
}

Is it possible to overwrite style for static columns?


AD Administrator Syncfusion Team March 16, 2010 07:36 PM UTC

any updates?


CB Clay Burch Syncfusion Team March 17, 2010 08:51 AM UTC

It is the ReadOnly setting that is preventing you from changing the cell style through code.

One comment is that if you make the cell Static, usually there is no need to also set it to ReadOnly as your user will not be able to type into a Static celltype.

If you want to keep using the ReadOnly cell style setting, then to make programatic changes to such ReadOnly styles, you need to first set the grid's IgnoreReadOnly property to true as in:

gridControl1.IgnoreReadOnly = true;
gridControl1[row, col].BackColor = Color.Red;
gridControl1.IgnoreReadOnly = false;


AD Administrator Syncfusion Team March 17, 2010 03:00 PM UTC

Thanks for the update. For some reason, this change does not work for our grid, may be because I assign style properties in runtime. So I left colStyleInfo.ReadOnly = true; in place and removed colStyleInfo.CellType = "Static"; This seems to do the trick.


JJ Jisha Joy Syncfusion Team March 22, 2010 07:21 AM UTC

Hi Irina,

Thank you for your update.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon