Datagridview Conditional Formatting in .Net 2005

G

Guest

Hi all,

I am using a datagridview in .Net 2005 to display data from a stored
procedure using a System.Data.SQLClient connection. After the stored
procedure dumps the data into a dataset and the datagridview is displayed I
need to conditionally format the backcolors of the rows (this will be
controlled by the value of a cell that contains a checkbox from the SQL
table). How do I change the row backcolor if the cell's check box is checked
on any given row (and there are many rows) - the row backcolor needs to be
changed to red, otherwise the row backcolor should be displayed as white.

I have tried several different pieces of code without any luck. Any help
would be appreciated. Thanks!
 
C

Chris

jbehrne said:
Hi all,

I am using a datagridview in .Net 2005 to display data from a stored
procedure using a System.Data.SQLClient connection. After the stored
procedure dumps the data into a dataset and the datagridview is displayed I
need to conditionally format the backcolors of the rows (this will be
controlled by the value of a cell that contains a checkbox from the SQL
table). How do I change the row backcolor if the cell's check box is checked
on any given row (and there are many rows) - the row backcolor needs to be
changed to red, otherwise the row backcolor should be displayed as white.

I have tried several different pieces of code without any luck. Any help
would be appreciated. Thanks!


http://msdn2.microsoft.com/en-us/library/z1cc356h.aspx

This should give you the information you are looking for.

Chris
 

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