Dynamically formatting a row in a Data Grid

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to change the forground color of a row in a Data Grid based on
the value of a certain column. I am using Visual C# .NET. Is there an
OnPaintRow event which I can subscribe to, or how can I do this?

Thanks,
Gudni Sigurdsson
 
hi

you have to do your own DataGridTextBoxColumn and override the Paint Method.
there is currently no other way to do that in .net 1.1 with the MS Data
Grid. but doing at your own needs about 10 codelines.. so nothing complex.

there are good articles about formating on codeproject:
http://www.codeproject.com/csharp/PracticalGuideDataGrids4.asp
http://www.codeproject.com/csharp/Apply_DataGridTableStyle.asp

there are several examples on the net:
http://groups.google.ch/group/micro...idTextBoxColumn&rnum=2&hl=de#b69052d31948b624
or
http://groups.google.ch/group/micro...idTextBoxColumn&rnum=7&hl=de#4ff50628a6dba523

good luck
jazper
 
Back
Top