472,353 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

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 11102
<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...
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...
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...
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. ...
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...
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...
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. ...
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.
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

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.