C# – Change the color of particular cell in datagrid

asp.netcwindows-mobile

I'm using VS 2008 to create a Windows Mobile program in C#. I need to display data in a grid. The only grid control I could find for Windows Mobile is DataGrid, so I placed one on my form. I now need to change the color of particular cell according to some condition. How do I do this?

Thanks in advance…

Best Answer

Usually grids have some kind of "fetching" event; your best solution is a row fetching or, at worst, a cell fetching event. Listening to this, you can trap the moment when the row/cell is being created and apply your style logic. This is true for grids spanning from VB6 to Asp.NET, so I suppose can apply on your case too.

Hope this helps! mt