473,847 Members | 1,483 Online
Bytes | Software Development & Data Engineering Community
+ 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:HyperLinkF ield HeaderText="Sub ject" Text="Subject"
DataTextField=" Subject" DataNavigateUrl Fields="Id"
DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

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 11262
<table>
<tr>
<td class="url">
<asp:HyperLin k ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO******** *****@TK2MSFTNG P05.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:HyperLinkF ield HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
DataNavigateUrl Fields="Id" DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

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:HyperLinkF ield HeaderText="Sub ject" Text="Subject"
DataTextField=" Subject"
DataNavigateUrl Fields="Id"
DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Jeff

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
<table>
<tr>
<td class="url">
<asp:HyperLin k ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO******** *****@TK2MSFTNG P05.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:HyperLink Field HeaderText="Sub ject" Text="Subject"
DataTextField= "Subject" DataNavigateUrl Fields="Id"
DataNavigateUr lFormatString=" ~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

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:HyperLinkF ield HeaderText="Sub ject" Text="Subject"
DataTextField=" Subject"
DataNavigateUrl Fields="Id"
DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Jeff

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
<table>
<tr>
<td class="url">
<asp:HyperLin k ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO******** *****@TK2MSFTNG P05.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:HyperLink Field HeaderText="Sub ject" Text="Subject"
DataTextField= "Subject" DataNavigateUrl Fields="Id"
DataNavigateUr lFormatString=" ~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

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:"und erline"; }

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.c ss" 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.NO SPAMwrote in message
news:eO******** ******@TK2MSFTN GP02.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:HyperLinkF ield HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
DataNavigateUrl Fields="Id" DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Jeff

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
><table>
<tr>
<td class="url">
<asp:HyperLi nk ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO******* ******@TK2MSFTN GP05.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:HyperLin kField HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
DataNavigateU rlFields="Id" DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

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.comwrot e in message
news:uZ******** ******@TK2MSFTN GP03.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:"und erline"; }

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.c ss" 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.NO SPAMwrote in message
news:eO******** ******@TK2MSFTN GP02.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:HyperLink Field HeaderText="Sub ject" Text="Subject"
DataTextField= "Subject"
DataNavigateUr lFields="Id"
DataNavigateUr lFormatString=" ~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Jeff

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2******* *********@TK2MS FTNGP02.phx.gbl ...
>><table>
<tr>
<td class="url">
<asp:HyperLin k ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO****** *******@TK2MSFT NGP05.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:HyperLi nkField HeaderText="Sub ject" Text="Subject"
DataTextFiel d="Subject" DataNavigateUrl Fields="Id"
DataNavigate UrlFormatString ="~/Templates/View.aspx?id={0 }"
HeaderStyl e-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Okay, I've already tryed this:
a:visited{
color:gree n;
}
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.NO SPAMwrote in message
news:ub******** ******@TK2MSFTN GP03.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.comwrot e in message
news:uZ******** ******@TK2MSFTN GP03.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:"und erline"; }

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.c ss" 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.NO SPAMwrote in message
news:eO******* *******@TK2MSFT NGP02.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:HyperLin kField HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
DataNavigateU rlFields="Id" DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Jeff

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2****** **********@TK2M SFTNGP02.phx.gb l...
<table>
<tr>
<td class="url">
<asp:HyperLi nk ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO***** ********@TK2MSF TNGP05.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:HyperL inkField HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
DataNavigat eUrlFields="Id" DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderSty le-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />
>
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 "HyperColRe d" 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.NO SPAMwrote in message
news:ub******** ******@TK2MSFTN GP03.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.comwrot e in message
news:uZ******* *******@TK2MSFT NGP03.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:"und erline"; }

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.c ss" 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.NO SPAMwrote in message
news:eO****** ********@TK2MSF TNGP02.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:HyperLi nkField HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
DataNavigate UrlFields="Id" DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyl e-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />

Jeff

"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2***** ***********@TK2 MSFTNGP02.phx.g bl...
<table>
<tr>
<td class="url">
<asp:HyperL ink ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
news:uO**** *********@TK2MS FTNGP05.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:Hyper LinkField HeaderText="Sub ject" Text="Subject" DataTextField=" Subject"
>DataNaviga teUrlFields="Id " DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
>HeaderStyl e-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />
>>
>Okay, I've already tryed this:
>a:visite d{
>color:gree n;
>}
>I cannot use this css code because it set the color on all visited link on my webpage. That is
>somethin g 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:HyperLinkF ield HeaderText="Sub ject" Text="Subject"
DataTextField=" Subject" DataNavigateUrl Fields="Id"
DataNavigateUrl FormatString="~/Templates/View.aspx?id={0 }"
HeaderStyle-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" >
<ControlStyle CssClass="r" />
</asp:HyperLinkFi eld >
a.r:visited
{
color:Lime;
}

Best regards!

Jeff

"Kevin Fernandes" <ke************ *@bmc.comwrote in message
news:%2******** ********@TK2MSF TNGP06.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 "HyperColRe d" 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.NO SPAMwrote in message
news:ub******* *******@TK2MSFT NGP03.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.comwrot e in message
news:uZ****** ********@TK2MSF TNGP03.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:"und erline"; }

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.c ss" type="text/css" rel="stylesheet " />

Summarizin g, 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.NO SPAMwrote in message
news:eO***** *********@TK2MS FTNGP02.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:HyperL inkField HeaderText="Sub ject" Text="Subject"
DataTextFie ld="Subject"
DataNavigat eUrlFields="Id"
DataNavigat eUrlFormatStrin g="~/Templates/View.aspx?id={0 }"
HeaderSty le-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle" />
>
Jeff
>
>
>
"Juan T. Llibre" <no***********@ nowhere.comwrot e in message
news:%2**** ************@TK 2MSFTNGP02.phx. gbl...
><table>
><tr>
><td class="url">
><asp:Hyper Link ID="1" runat="server" NavigateUrl="so me.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.NO SPAMwrote in message
>news:uO*** **********@TK2M SFTNGP05.phx.gb l...
>>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:Hype rLinkField HeaderText="Sub ject" Text="Subject"
>>DataTextF ield="Subject" DataNavigateUrl Fields="Id"
>>DataNavig ateUrlFormatStr ing="~/Templates/View.aspx?id={0 }"
>>HeaderSty le-CssClass="colum nStyle" ItemStyle-CssClass="colum nStyle"
>>/>
>>>
>>Okay, I've already tryed this:
>>a:visited {
>>color:gre en;
>>}
>>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:
>>GridVie w 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
8515
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 (which is not, in this case). I can't find any documented way to change the default fill color (if that's what it is) for the corners, and PIL also doesn't seem to support a flood fill. I have created a flood fill in Python, which works but which...
1
32279
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? Thanks, Chris Ullman
0
5683
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 black. http://www.personal.psu.edu/axg251/wc In the original external style sheet, I set the a:link, a:visited, a:active, and a:hover. That works fine. In the navigation page, I call a function for onclick - it sets the
18
10756
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 where they have been. I also agree to the background: Too many web authors keep uniform link colors or their pages, thereby confusing the users. What I have a hard time agreeing to is his conclusion that web authors should deliberately change the...
0
1339
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 graphics.Clear and the transparent color but no luck, anybody got any suggestions?. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
2
1658
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 hover the mouse over the link button control, I can see the custom javascript in the browser's status bar. It puts a wrapper around the usual __doPostBack function call. Is this wrapper causing IE to get confused as to the visited status of the...
7
17469
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 application, I don't see any color change. I am using Visual Studio 2005, ASP.NEt 2.0.
1
1084
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
9889
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9732
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10652
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...
0
10344
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7058
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
5914
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4126
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3166
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.