×

Using color in a datagrid

Last updated: July 19, 2022

It is possible to give a row in a datagrid a different color based on the contents of a column that row.

 Select	[Velden]
 ,	case	when [Customers].[Custom Risk] = 'H' 
   then 'Red' 
   when [Customers].[Custom Risk] = 'M' 
   then 'Orange' 
   else 'Cyan'
 end						as [Row_BackColor]

To be able to do this you would first need to run the attached script, to create the necessary tables.