all groups > dotnet general > december 2006 >
You're in the

dotnet general

group:

Supress Alternating Row Style for Specific Data Grid Column?



Supress Alternating Row Style for Specific Data Grid Column? Daniel Manes
12/20/2006 1:49:34 PM
dotnet general: My DataGridView is set up like this:
* Main row background color = white
* Alternating row background color = light gray

I also have a read-only (non-editable) column I want to show up as
solid dark gray (i.e., no alternating row colors), but it shows up as
alternating dark/light gray.

Is there any way to get around this?

Thanks,

-Dan
Re: Supress Alternating Row Style for Specific Data Grid Column? Daniel Manes
12/20/2006 2:58:42 PM
Never mind...turned out I needed to use CellTemplate.Style.BackColor
instead of DefaultCellStyle.BackColor.

-Dan

[quoted text, click to view]
Re: Supress Alternating Row Style for Specific Data Grid Column? Thomas Holloway
12/20/2006 4:05:51 PM
You can subscribe to the DataGridView's RowsAdded event. Each time a row is
added, you can set the style of the desired column. This would be a fast fix
to that.


[quoted text, click to view]
Re: Supress Alternating Row Style for Specific Data Grid Column? Thomas Holloway
12/20/2006 4:10:13 PM
Oh nice
[quoted text, click to view]
AddThis Social Bookmark Button