473,465 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

setting HyperLinkField visited color, how??

ASP.NET 2.0

I'm wondering how to set the color of a visited HyperLinkField (the link
text) in a GridView??

Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject" DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link on
my webpage. That is something I don't want. I want to set the color of
visited links within a GridView only.

I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no links on
my webpage was affected by this css class

Any suggestions?

Best Regards!

Jeff
Apr 18 '07 #1
8 11237
<table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx" >Some</asp:HyperLink>
</td>
</tr>
</table>

Then, in your style sheet :

..url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}

..url a:visited {
color: red;
}

....or any variation of the above.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
ASP.NET 2.0

I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView??

Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link on my webpage. That is
something I don't want. I want to set the color of visited links within a GridView only.

I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no links on my webpage was
affected by this css class

Any suggestions?

Best Regards!

Jeff

Apr 18 '07 #2
Thanks for that example but I'm wondering about setting the visited color of
a HyperLinkField object (not a HyperLink object) in a GridView. I don't see
how to apply the example you provided to my scenario (okay I'm a newbie).

This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject"
DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Jeff

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
<table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx"
>Some</asp:HyperLink>
</td>
</tr>
</table>

Then, in your style sheet :

.url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}

.url a:visited {
color: red;
}

...or any variation of the above.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
>ASP.NET 2.0

I'm wondering how to set the color of a visited HyperLinkField (the link
text) in a GridView??

Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject" DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link
on my webpage. That is something I don't want. I want to set the color of
visited links within a GridView only.

I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no links
on my webpage was affected by this css class

Any suggestions?

Best Regards!

Jeff


Apr 18 '07 #3
Thanks for that example but I'm wondering about setting the visited color of
a HyperLinkField object (not a HyperLink object) in a GridView. I don't see
how to apply the example you provided to my scenario (okay I'm a newbie).

This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject"
DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Jeff

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
<table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx"
>Some</asp:HyperLink>
</td>
</tr>
</table>

Then, in your style sheet :

.url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}

.url a:visited {
color: red;
}

...or any variation of the above.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
>ASP.NET 2.0

I'm wondering how to set the color of a visited HyperLinkField (the link
text) in a GridView??

Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject" DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link
on my webpage. That is something I don't want. I want to set the color of
visited links within a GridView only.

I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no links
on my webpage was affected by this css class

Any suggestions?

Best Regards!

Jeff


Apr 18 '07 #4
re:
I don't see how to apply the example you provided to my scenario
For example :

A:link { color: #265CC0; text-decoration:none; }
A:visited { color: #000080; text-decoration:none; }
A:active { color: #265CC0; cursor:hand; text-decoration:none; }
A:hover { color: #4D9FE1; cursor:hand; text-decoration:"underline"; }

Take a look at :

http://asp.net.do/faq/default.aspx

That's the css code I use to change the link colors at that FAQ site.
Of course, you can change those colors to any other colors you want

After you visit the page, copy the default.css file from your browser's cache and use it as
guidance.
All I do to include it is use this code in the masterpage :

<link href="default.css" type="text/css" rel="stylesheet" />

Summarizing, you don't have to do anything special or different.
Just use css styles as you'd use them in any other web page.

The HyperLink object behaves like a standard link and picks up css styles specified for links.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
Thanks for that example but I'm wondering about setting the visited color of a HyperLinkField
object (not a HyperLink object) in a GridView. I don't see how to apply the example you provided
to my scenario (okay I'm a newbie).

This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Jeff

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
><table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx" >Some</asp:HyperLink>
</td>
</tr>
</table>

Then, in your style sheet :

.url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}

.url a:visited {
color: red;
}

...or any variation of the above.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
>>ASP.NET 2.0

I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView??

Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link on my webpage. That is
something I don't want. I want to set the color of visited links within a GridView only.

I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no links on my webpage was
affected by this css class

Any suggestions?

Best Regards!

Jeff



Apr 18 '07 #5
Thanks for the examples but A:link { color: #265CC0;
text-decoration:none; } will as I understand it set the color on all links
on a webpage. This is not how I want it. I want only to set the color of
visited HyperLinkField (not HyperLink) links with in a GridView on my
webpage.

any suggestions??

Jeff


"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uZ**************@TK2MSFTNGP03.phx.gbl...
re:
>I don't see how to apply the example you provided to my scenario

For example :

A:link { color: #265CC0; text-decoration:none; }
A:visited { color: #000080; text-decoration:none; }
A:active { color: #265CC0; cursor:hand; text-decoration:none; }
A:hover { color: #4D9FE1; cursor:hand; text-decoration:"underline"; }

Take a look at :

http://asp.net.do/faq/default.aspx

That's the css code I use to change the link colors at that FAQ site.
Of course, you can change those colors to any other colors you want

After you visit the page, copy the default.css file from your browser's
cache and use it as guidance.
All I do to include it is use this code in the masterpage :

<link href="default.css" type="text/css" rel="stylesheet" />

Summarizing, you don't have to do anything special or different.
Just use css styles as you'd use them in any other web page.

The HyperLink object behaves like a standard link and picks up css styles
specified for links.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
>Thanks for that example but I'm wondering about setting the visited color
of a HyperLinkField object (not a HyperLink object) in a GridView. I
don't see how to apply the example you provided to my scenario (okay I'm
a newbie).

This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject"
DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Jeff

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
>><table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx"
>Some</asp:HyperLink>
</td>
</tr>
</table>

Then, in your style sheet :

.url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}

.url a:visited {
color: red;
}

...or any variation of the above.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
ASP.NET 2.0

I'm wondering how to set the color of a visited HyperLinkField (the
link text) in a GridView??

Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject" DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link
on my webpage. That is something I don't want. I want to set the color
of visited links within a GridView only.

I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no
links on my webpage was affected by this css class

Any suggestions?

Best Regards!

Jeff



Apr 19 '07 #6
Can you set individual hyperlink visited colors in *any* other platform ?
You may be asking for what no platform can deliver.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
Thanks for the examples but A:link { color: #265CC0; text-decoration:none; } will as I
understand it set the color on all links on a webpage. This is not how I want it. I want only to
set the color of visited HyperLinkField (not HyperLink) links with in a GridView on my webpage.

any suggestions??

Jeff


"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uZ**************@TK2MSFTNGP03.phx.gbl...
>re:
>>I don't see how to apply the example you provided to my scenario

For example :

A:link { color: #265CC0; text-decoration:none; }
A:visited { color: #000080; text-decoration:none; }
A:active { color: #265CC0; cursor:hand; text-decoration:none; }
A:hover { color: #4D9FE1; cursor:hand; text-decoration:"underline"; }

Take a look at :

http://asp.net.do/faq/default.aspx

That's the css code I use to change the link colors at that FAQ site.
Of course, you can change those colors to any other colors you want

After you visit the page, copy the default.css file from your browser's cache and use it as
guidance.
All I do to include it is use this code in the masterpage :

<link href="default.css" type="text/css" rel="stylesheet" />

Summarizing, you don't have to do anything special or different.
Just use css styles as you'd use them in any other web page.

The HyperLink object behaves like a standard link and picks up css styles specified for links.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
>>Thanks for that example but I'm wondering about setting the visited color of a HyperLinkField
object (not a HyperLink object) in a GridView. I don't see how to apply the example you
provided to my scenario (okay I'm a newbie).

This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Jeff

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
<table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx" >Some</asp:HyperLink>
</td>
</tr>
</table>

Then, in your style sheet :

.url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}

.url a:visited {
color: red;
}

...or any variation of the above.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
ASP.NET 2.0
>
I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView??
>
Here is the markup of the HyperLinkField I have problems with:
<asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />
>
Okay, I've already tryed this:
a:visited{
color:green;
}
I cannot use this css code because it set the color on all visited link on my webpage. That is
something I don't want. I want to set the color of visited links within a GridView only.
>
I also tryed this:
GridView a:visited
{
color:Orange;
} -but that didn't change the color within my GridView, infact no links on my webpage was
affected by this css class
>
Any suggestions?
>
Best Regards!
>
Jeff
>




Apr 19 '07 #7
Hi Jeff,
I'll take a stab at this, but no guarentees :)

If I understand correctly, you want to set the color of a "visited"
HyperLinkField.

The problem is that the VS designer does not expose a way to do this
directly. As explained before, you will need to set CSS styles manually
in order to accomplish this (I believe).

You are correct that using A:visited { color: red; } as is, will set the
color of all visited hyperlinks (A tags) to that color wherever they
might appear in the document or site (using the CSS). What you need to
do is classify the style more. For instance you know that a GridView
will generate a table so you could do something like this

table A:visited {color: red;}

This CSS will only affect A tags that appear in a table.

If this is too broad; you have multiple hyperlink columns and only want
one of them to be "red" and the rest remain the same or there are tables
that should not be affected at all, then you need to use CSS classes or
control ID references.

I think the ID references would be problematic with dynamically
generated HTML so CSS classes would be better.

For instance, if you had a GridView with two HyperLinkField columns and
you wanted one to be "green" when visited and the other to be "red" you
might have CSS styles like the following:

..MyGridView .HyperColRed A:visited {color:red;}
..MyGridView .HyperColGreen A:visited {color:green;}

Then in the GridView's properties set the CssClass property to
"MyGridView" and in the HyperLinkField properties, open the ItemStyle
and set the CssClass to either "HyperColRed" or "HyperColGreen".
Alternately, you can set the ControlStyle CssClass instead, this will
affect "ALL" controls in the column regardless of which template they
appear in (i.e. Header, Footer, Item, or Edit).

Unfortunately I cannot guarantee this will work properly if you are
using Auto Formatting on the GridView, or other controls. If you are,
you may have to view the generated HTML to see what HTML and CSS was
produced, then copy some or all of it into your own styles.

Anyway, I hoped this help answer your question and sorry for the long
winded response.
:)

Good luck!
Kevin F.

Juan T. Llibre wrote:
Can you set individual hyperlink visited colors in *any* other platform ?
You may be asking for what no platform can deliver.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
>Thanks for the examples but A:link { color: #265CC0; text-decoration:none; } will as I
understand it set the color on all links on a webpage. This is not how I want it. I want only to
set the color of visited HyperLinkField (not HyperLink) links with in a GridView on my webpage.

any suggestions??

Jeff


"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uZ**************@TK2MSFTNGP03.phx.gbl...
>>re:
I don't see how to apply the example you provided to my scenario
For example :

A:link { color: #265CC0; text-decoration:none; }
A:visited { color: #000080; text-decoration:none; }
A:active { color: #265CC0; cursor:hand; text-decoration:none; }
A:hover { color: #4D9FE1; cursor:hand; text-decoration:"underline"; }

Take a look at :

http://asp.net.do/faq/default.aspx

That's the css code I use to change the link colors at that FAQ site.
Of course, you can change those colors to any other colors you want

After you visit the page, copy the default.css file from your browser's cache and use it as
guidance.
All I do to include it is use this code in the masterpage :

<link href="default.css" type="text/css" rel="stylesheet" />

Summarizing, you don't have to do anything special or different.
Just use css styles as you'd use them in any other web page.

The HyperLink object behaves like a standard link and picks up css styles specified for links.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
Thanks for that example but I'm wondering about setting the visited color of a HyperLinkField
object (not a HyperLink object) in a GridView. I don't see how to apply the example you
provided to my scenario (okay I'm a newbie).

This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />

Jeff

"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl. ..
<table>
<tr>
<td class="url">
<asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx" >Some</asp:HyperLink>
</td>
</tr>
</table>
>
Then, in your style sheet :
>
.url a {
font-family: Arial;
font-size: 9px;
color: navy;
text-decoration: none;
}
>
.url a:visited {
color: red;
}
>
...or any variation of the above.
>
>
>
>
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:uO*************@TK2MSFTNGP05.phx.gbl...
>ASP.NET 2.0
>>
>I'm wondering how to set the color of a visited HyperLinkField (the link text) in a GridView??
>>
>Here is the markup of the HyperLinkField I have problems with:
><asp:HyperLinkField HeaderText="Subject" Text="Subject" DataTextField="Subject"
>DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
>HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />
>>
>Okay, I've already tryed this:
>a:visited{
>color:green;
>}
>I cannot use this css code because it set the color on all visited link on my webpage. That is
>something I don't want. I want to set the color of visited links within a GridView only.
>>
>I also tryed this:
>GridView a:visited
>{
> color:Orange;
>} -but that didn't change the color within my GridView, infact no links on my webpage was
>affected by this css class
>>
>Any suggestions?
>>
>Best Regards!
>>
>Jeff
>>
>


Apr 19 '07 #8
Hey guys!

I've solved it by using ControlStyle, see the example below

<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject" DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" >
<ControlStyle CssClass="r" />
</asp:HyperLinkField >
a.r:visited
{
color:Lime;
}

Best regards!

Jeff

"Kevin Fernandes" <ke*************@bmc.comwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
Hi Jeff,
I'll take a stab at this, but no guarentees :)

If I understand correctly, you want to set the color of a "visited"
HyperLinkField.

The problem is that the VS designer does not expose a way to do this
directly. As explained before, you will need to set CSS styles manually
in order to accomplish this (I believe).

You are correct that using A:visited { color: red; } as is, will set the
color of all visited hyperlinks (A tags) to that color wherever they might
appear in the document or site (using the CSS). What you need to do is
classify the style more. For instance you know that a GridView will
generate a table so you could do something like this

table A:visited {color: red;}

This CSS will only affect A tags that appear in a table.

If this is too broad; you have multiple hyperlink columns and only want
one of them to be "red" and the rest remain the same or there are tables
that should not be affected at all, then you need to use CSS classes or
control ID references.

I think the ID references would be problematic with dynamically generated
HTML so CSS classes would be better.

For instance, if you had a GridView with two HyperLinkField columns and
you wanted one to be "green" when visited and the other to be "red" you
might have CSS styles like the following:

.MyGridView .HyperColRed A:visited {color:red;}
.MyGridView .HyperColGreen A:visited {color:green;}

Then in the GridView's properties set the CssClass property to
"MyGridView" and in the HyperLinkField properties, open the ItemStyle and
set the CssClass to either "HyperColRed" or "HyperColGreen". Alternately,
you can set the ControlStyle CssClass instead, this will affect "ALL"
controls in the column regardless of which template they appear in (i.e.
Header, Footer, Item, or Edit).

Unfortunately I cannot guarantee this will work properly if you are using
Auto Formatting on the GridView, or other controls. If you are, you may
have to view the generated HTML to see what HTML and CSS was produced,
then copy some or all of it into your own styles.

Anyway, I hoped this help answer your question and sorry for the long
winded response.
:)

Good luck!
Kevin F.

Juan T. Llibre wrote:
>Can you set individual hyperlink visited colors in *any* other platform ?
You may be asking for what no platform can deliver.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:ub**************@TK2MSFTNGP03.phx.gbl...
>>Thanks for the examples but A:link { color: #265CC0;
text-decoration:none; } will as I understand it set the color on all
links on a webpage. This is not how I want it. I want only to set the
color of visited HyperLinkField (not HyperLink) links with in a GridView
on my webpage.

any suggestions??

Jeff


"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:uZ**************@TK2MSFTNGP03.phx.gbl...
re:
I don't see how to apply the example you provided to my scenario
For example :

A:link { color: #265CC0; text-decoration:none; }
A:visited { color: #000080; text-decoration:none; }
A:active { color: #265CC0; cursor:hand; text-decoration:none; }
A:hover { color: #4D9FE1; cursor:hand; text-decoration:"underline"; }

Take a look at :

http://asp.net.do/faq/default.aspx

That's the css code I use to change the link colors at that FAQ site.
Of course, you can change those colors to any other colors you want

After you visit the page, copy the default.css file from your browser's
cache and use it as guidance.
All I do to include it is use this code in the masterpage :

<link href="default.css" type="text/css" rel="stylesheet" />

Summarizing, you don't have to do anything special or different.
Just use css styles as you'd use them in any other web page.

The HyperLink object behaves like a standard link and picks up css
styles specified for links.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Jeff" <it************@hotmail.com.NOSPAMwrote in message
news:eO**************@TK2MSFTNGP02.phx.gbl...
Thanks for that example but I'm wondering about setting the visited
color of a HyperLinkField object (not a HyperLink object) in a
GridView. I don't see how to apply the example you provided to my
scenario (okay I'm a newbie).
>
This is the markup of the HyperLinkField field in my webpage
<asp:HyperLinkField HeaderText="Subject" Text="Subject"
DataTextField="Subject"
DataNavigateUrlFields="Id"
DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle" />
>
Jeff
>
>
>
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl.. .
><table>
><tr>
><td class="url">
><asp:HyperLink ID="1" runat="server" NavigateUrl="some.aspx"
> >Some</asp:HyperLink>
></td>
></tr>
></table>
>>
>Then, in your style sheet :
>>
>.url a {
>font-family: Arial;
>font-size: 9px;
>color: navy;
>text-decoration: none;
>}
>>
>.url a:visited {
>color: red;
>}
>>
>...or any variation of the above.
>>
>>
>>
>>
>Juan T. Llibre, asp.net MVP
>asp.net faq : http://asp.net.do/faq/
>foros de asp.net, en español : http://asp.net.do/foros/
>===================================
>"Jeff" <it************@hotmail.com.NOSPAMwrote in message
>news:uO*************@TK2MSFTNGP05.phx.gbl.. .
>>ASP.NET 2.0
>>>
>>I'm wondering how to set the color of a visited HyperLinkField (the
>>link text) in a GridView??
>>>
>>Here is the markup of the HyperLinkField I have problems with:
>><asp:HyperLinkField HeaderText="Subject" Text="Subject"
>>DataTextField="Subject" DataNavigateUrlFields="Id"
>>DataNavigateUrlFormatString="~/Templates/View.aspx?id={0}"
>>HeaderStyle-CssClass="columnStyle" ItemStyle-CssClass="columnStyle"
>>/>
>>>
>>Okay, I've already tryed this:
>>a:visited{
>>color:green;
>>}
>>I cannot use this css code because it set the color on all visited
>>link on my webpage. That is something I don't want. I want to set
>>the color of visited links within a GridView only.
>>>
>>I also tryed this:
>>GridView a:visited
>>{
>> color:Orange;
>>} -but that didn't change the color within my GridView, infact no
>>links on my webpage was affected by this css class
>>>
>>Any suggestions?
>>>
>>Best Regards!
>>>
>>Jeff
>>>
>>
>

Apr 19 '07 #9

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

Similar topics

6
by: rzed | last post by:
I'm using PIL to generate some images which may be rotated at the user's option. When they are rotated, the original image is cropped in the new image (which is fine), and the corners are black...
1
by: Chris Ullman | last post by:
Simply put - if I have a disabled textbox how could I change the font-color from gray? e.g. <input type="text" disabled></input> Color no longer seems to work. Can it be done and if so how? ...
0
by: Andrea | last post by:
Hi everyone. I'm working on a navigation menu (in a frameset) that I want to set the "active" link to black (the link that corresponds to the page displayed in the right side of the frame) to...
18
by: Jan Tuxen | last post by:
Jakob Nielsen in his most recent Alertbox (http://www.useit.com/alertbox/20040503.html) tells web authors to change the color of visited links. I agree to his purpose: Help users understand...
0
by: James Dean | last post by:
I have a method i found for setting the background of a bitmap transparent but its slow must be an easier way than saving the image then setting all the pixels to the background color. I tried...
2
by: Dot net work | last post by:
I have a 3rd party link button control that when clicked does not retain it's visited color status on postback. (Actually, the first control on the form does, but all others do not.) When I...
7
by: =?Utf-8?B?UmVraGE=?= | last post by:
Hi, I am trying to change the font color for the items in a dropdownlist control at run time using ASP.NET 2.0. DropDownList1.Items.Attributes.Add("style", "color:red"); But when I run the...
1
by: parimalao | last post by:
hi all, i want to set asp:label with background half with one color and aonther half with another color. plz help me. thanku.
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
1
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...
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...
0
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.