473,405 Members | 2,187 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,405 software developers and data experts.

Alternating Row style in DataGridView

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;
}

makes all links white (as expected)

and changing the ForeColor property in the AlternatingRowStyle options
does not effect the <atag in the data column - it still shows up
blue. Placing additional formatting for the column will not help since
it will apply to all data in the column and not just the alternating
rows.
Mike

Jan 25 '07 #1
4 5661
Did you try AlternatingRowStyle.CssClass?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
<mi**@5starserv.comwrote in message
news:11*********************@l53g2000cwa.googlegro ups.com...
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;
}

makes all links white (as expected)

and changing the ForeColor property in the AlternatingRowStyle options
does not effect the <atag in the data column - it still shows up
blue. Placing additional formatting for the column will not help since
it will apply to all data in the column and not just the alternating
rows.
Mike

Jan 25 '07 #2

Hi,
Try add a css for the alternate row style....
In proproperty grid of the grid view you have alternaterowstyle...
in the cssclass field put your custom css....
and then in stylesheet file add the styles....

..alternaterow
{
background-color:Teal;
}
..alternaterow a
{
color:Yellow;
}
..alternaterow a:hover
{
color:red;
}

Thanks

Masudur
http://www.kaz.com.bd
http://munnacs.blogspot.com

On Jan 25, 8:24 pm, m...@5starserv.com wrote:
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;

}makes all links white (as expected)

and changing the ForeColor property in the AlternatingRowStyle options
does not effect the <atag in the data column - it still shows up
blue. Placing additional formatting for the column will not help since
it will apply to all data in the column and not just the alternating
rows.

Mike
Jan 25 '07 #3
I added the following to my stylesheet

..altgridrow {

color: white;

}

and then referenced it in properties for
AlternateRowStyle.CssClass=altgridrow

apparently, since the column data contains a link it regards the
content as <atag and does not use the row style settings.

it might require iterating over the rows and setting the alternating
ones when the page loads or something like that.

I'd love to hear a easier method though :)


On Jan 25, 9:39 am, "Eliyahu Goldin"
<REMOVEALLCAPITALSeEgGoldD...@mMvVpPsS.orgwrote:
Did you try AlternatingRowStyle.CssClass?

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]http://msmvps.com/blogs/egoldinhttp://usableasp.net

<m...@5starserv.comwrote in messagenews:11*********************@l53g2000cwa.go oglegroups.com...
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;
}
makes all links white (as expected)
and changing the ForeColor property in the AlternatingRowStyle options
does not effect the <atag in the data column - it still shows up
blue. Placing additional formatting for the column will not help since
it will apply to all data in the column and not just the alternating
rows.
Mike- Hide quoted text -- Show quoted text -
Jan 25 '07 #4
Works like a charm! Thanks!

On Jan 25, 9:51 am, "Masudur" <munn...@gmail.comwrote:
Hi,
Try add a css for the alternate row style....
In proproperty grid of the grid view you have alternaterowstyle...
in the cssclass field put your custom css....
and then in stylesheet file add the styles....

.alternaterow
{
background-color:Teal;}.alternaterow a
{
color:Yellow;}.alternaterow a:hover
{
color:red;

}Thanks

Masudurhttp://www.kaz.com.bdhttp://munnacs.blogspot.com

On Jan 25, 8:24 pm, m...@5starserv.com wrote:
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;
}makes all links white (as expected)
and changing the ForeColor property in the AlternatingRowStyle options
does not effect the <atag in the data column - it still shows up
blue. Placing additional formatting for the column will not help since
it will apply to all data in the column and not just the alternating
rows.
Mike- Hide quoted text -- Show quoted text -
Jan 25 '07 #5

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?...
4
by: Rob | last post by:
Is there a way to set alternating item style for a ListBox? I know it doesn't exist but is there a way to mimmick the Datagrid's AlternatingItemStyle? Thanks Rob *** Sent via Developersdex...
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...
0
by: Tolgan | last post by:
I have a datagridview whose DataSource property is set to a (class derived from ) BindingList. I want to highlight certain cells whose values are abnormal. So I'm writing code like ...
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...
3
by: obrienkev | last post by:
Hi all, I want to format the style of datagridview in Visual Studio 2005. The dataGridView is inside a GroupBox. This is a desktop application. The dataGridViews revert to this style for...
1
by: Sachin | last post by:
Hi All, I am using ASP.NET Repeater Web Control. I want to use different stylesheets for alternating rows similar to DataGrid contorl. How can I do this? Thanks In Advance Sachin
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.