Changing the Color of a Row in a Datagrid

G

Guest

C# WinForms

I am trying to find a good solution for changing the color of a row in a
datagrid, at runtime, based on the contents of a certain cell of the row, or
a related value in the database. I cant believe it is as hard as I am
finding. This is surely a common problem.

All the solutions I have found so far though, seem very specific, and that
if I want this in various datagrids through my application I will have to
have a load of custom DataGridTextColumns with Paint overrided.

I have a custom Datagrid object which has in it various custom methods and
properties that I want all my datagrids to have, so ideally I want to put
this row colour function in there, or in a similar high up object so I dont
have to keep creating custom column styles. Has anyone done anything like
this before or does everyone just keep overriding the column style??

Thanks

Ste
 
G

Guest

One more thing. I see that in WebForms you can hook into the row through
the ItemDataBound event. Is there not an equivalent entry point for
WinForms??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top