By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,813 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,813 IT Pros & Developers. It's quick & easy.

Alternating Row style in DataGridView

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a

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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.