473,386 Members | 1,775 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,386 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 4691
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...
47
by: Matt Kruse | last post by:
http://www.mattkruse.com/temp/css_expressions.html One of the standard CSS questions is "how can I shade every other table row a different color with CSS?" The answers are usually 1) you can't...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.