473,796 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 AlternatingRowS tyle 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 5689
Did you try AlternatingRowS tyle.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******** *************@l 53g2000cwa.goog legroups.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 AlternatingRowS tyle 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 alternaterowsty le...
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 AlternatingRowS tyle 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
AlternateRowSty le.CssClass=alt gridrow

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"
<REMOVEALLCAPIT ALSeEgGoldD...@ mMvVpPsS.orgwro te:
Did you try AlternatingRowS tyle.CssClass?

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

<m...@5starserv .comwrote in messagenews:11* *************** *****@l53g2000c wa.googlegroups .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 AlternatingRowS tyle 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 alternaterowsty le...
in the cssclass field put your custom css....
and then in stylesheet file add the styles....

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

}Thanks

Masudurhttp://www.kaz.com.bdh ttp://munnacs.blogspo t.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 AlternatingRowS tyle 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
4580
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 one myself, but I need some help to finish it. I use the getAttribute('rowIndex') to return the position of a row within the table and apply modulo 2 to return a 0 or 1 indicating an even or odd row number, from which I apply the alternating...
47
18906
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 (yet), 2) put a class on every other tr, or 3) use javascript to do the styling for you. Well, I've been playing the CSS expressions quite a bit lately and I've found a much simpler solution which works in IE5.5+, using "expressions". If
1
4679
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? Here is my code: <asp:DataList id=dlKommuner runat="server" Width="400px" RepeatColumns="2" CellPadding="3"> <AlternatingItemStyle Width="200px" CssClass="arow"> </AlternatingItemStyle>
4
3647
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 http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
9
2695
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 perform updates. All the styles that are set are being followed by all templated columns with the exception for the update column. The update column does set the BackColor appropriately but when setting its ForeColor the LinkButton's color is blue and...
0
1254
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 highlightStyle = new DataGridViewCellStyle (... etc); .... and then iterating down the rows and when I find an abnormal cell I have code like
3
3715
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 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?
3
3711
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 DefaultCellStyle Property... Font: Verdana,12px,Bold, Forecolor: InactiveCaptionText And for the ColumnHeadersDefaultCellStyle the backcolor doesn't take effect.
1
3277
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
10236
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10182
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6793
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5445
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5577
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.