DataGrid Row Color

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Is it possible to change the backcolor of all rows in a
Windows VB.Net DataGrid that have a common
characteristic. For example, all rows with a balance <
$0?
 
Hello Dave,

Thanks for your post. As I understand, you want to change the backcolor on
condition for datagrid cells. Please correct me if there is any
misunderstanding. I'd like to share the following information with you:

1. If it's a DataGrid web control, you can use the DataGridItem.BackColor
property to set the color of certain cells. Please refer to the following
sample:

Conditional Formatting ASP.NET DataGrid Columns
http://www.codeproject.com/aspnet/gridcolumnformatting.asp

2. If you are using DataGrid WinForm control, you will need to override the
Paint() method to draw the backcolor of certain cells. The following
articles provides more detailed information on this subject:

As suggested by Ken, it's very helpful:
http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp?print=745

Changing the background color of cells in a DataGrid
http://www.codeproject.com/csharp/custom_datagridcolumnstyl.asp

Please feel free to let me know if you have any problems or concerns.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top