473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Supress Alternating Row Style for Specific Data Grid Column?

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

Dec 20 '06 #1
3 3684
Never mind...turned out I needed to use CellTemplate.Style.BackColor
instead of DefaultCellStyle.BackColor.

-Dan

Daniel Manes wrote:
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
Dec 20 '06 #2
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.
"Daniel Manes" <da******@cox.netwrote in message
news:11**********************@79g2000cws.googlegro ups.com...
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
Dec 20 '06 #3
Oh nice
"Daniel Manes" <da******@cox.netwrote in message
news:11**********************@i12g2000cwa.googlegr oups.com...
Never mind...turned out I needed to use CellTemplate.Style.BackColor
instead of DefaultCellStyle.BackColor.

-Dan

Daniel Manes wrote:
>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
Dec 20 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alistair Birch | last post by:
Hi I want rows of a table to appear in alternating background colours. Having looked around the web I can't find any solution apart from waiting for the next version of CSS, so I tried building...
1
by: Eirik Eldorsen | last post by:
I'm trying to set alternating bgcolor for a datalist with 2 columns. My problem is that its the alternating cell that get the bgcolor, not the row. Is it possible to set alternating color of rows?...
9
by: Max Weebler | last post by:
Hi, I have a datagrid built that has an alternating item style that sets the backcolor and ForeColor of its rows. I have 4 template columns. One of them has a LinkButton embedded in it to...
4
by: Michael | last post by:
Dear all .. If I want to use develop a user control and declare a public property which the type is System.Windows.Forms.GridTableStylesCollection For example : Public Class LookAndView...
1
by: Ryan Liu | last post by:
Hi, Is there a way to specify data Grid column Style if its DataSource is an IList(ArrayList), not a datatable? Can I selectively only show few columns, not all of its properties? Thanks!
3
by: Daniel Manes | last post by:
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...
4
by: mike | last post by:
how can I change the font color for an alternating row where the column data is formatted as a link? setting a style in the stylesheet for a { color:white; }
7
by: moondaddy | last post by:
I have WPF window and a grid. The grid has several columns and rows. How do I add an object to a specific row and column of the gird using c#? If I use: myGrid.Children.Add(dg); then dg...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.