making hyperlink look 'visited'

A

Al Cadalzo

I want to programmatically make a asp:hyperlink appear as if it's been
visited. I experimented with setting it's enabled property to false, but I
wasn't satisfied with the appearance, so I tried this approach:

Dim cntrl As Control
Dim hlink As HyperLink
cntrl = FindControl(lnkID)
If Not cntrl Is Nothing Then
hlink = DirectCast(cntrl, HyperLink)
hlink.NavigateUrl = String.Empty
hlink.ForeColor = Color.Black
End If

The ForeColor does change to black, but I've tried setting hlink.Underline =
False but that didn't work, it still appears underlined, so I thought maybe
I would take a different approach and try making it's state 'Visited' so
that it would pick up the style for a 'visited' link from the stylesheet.
Does anyone know how to do that?

Thanks,
Al
 
F

Fred Hirschfeld

Your best bet is to actually use a stylesheet to set a class that can be
applied with the same formatting as a visited link.
 
A

Al Cadalzo

Thanks Fred. I'll try that.

Fred Hirschfeld said:
Your best bet is to actually use a stylesheet to set a class that can be
applied with the same formatting as a visited link.


but hlink.Underline
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top