Datagridview Conditional Formatting in .Net 2005

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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
 
Back
Top