Hyperlink control visited / unvisited behavior - I don't get it

D

Don M

I am currently using a Hyperlink Column in a Datagrid to display
images of the Datagrid line item when a user clicks on the link. The
visited / unvisited color change of the Hyperlink is very usefull in
letting users know what they have already looked at.

However in my app when a user navigates back to the page with the
datagrid, I would like to set the Hyperlink column to the unvisited
state.

I have attempted to resolve this per conrol by converting the
Hyperlink Column to a template column to disable the controls
ViewState. I have also played disabling the datagrid and page
ViewState.

Just for kicks I decided to try out the Link Button control but this
is also behaving in the same way.

Admittedly my HTML skills are not very strong. What am I missing here?
Is this client side browser stuff that is out of my control?

Thanks in advance for any insight or suggestions.
 
A

Alessandro Zifiglio

The select state of an anchor element is to show visitors that they have
already visited the link. Now why would you want to change this behaviour.
If a user hits the back button on the browser surely any links they already
visited will have the visited state.

To answer your question, yes you can control this through css style for your
hyperlink control , but you wont be able to do exactly what you want that is
when hitting the back button make those changes. You will have to resort to
a combination of javascript and css, that is to check if the user hit the
back button to get on the page and if they did to change the css style from
javascript.


In css the ability to change the properties of a element based on the state
of the element can be accomplished by using a Pseudo Class Element.

The Anchor < A > element can have different rendering properties applied to
it based upon the current state.

The possible variations include:

link - unvisited links
visited - visited links
hover - user hovers
active - active links

so to apply this you would do :


..datagrid a: link {
color: blue;
}

..datagrid a: visited {
color: blue;
}


..datagrid a: hover {
color: green;
}

..datagrid a: active {
color: yellow;
}

now all you need to do is suppy "datagrid" to your cssclass property of your
hyperlink control, the one displaying in your grid. Notice how in the above
example the visited state and the unvisited state have the same color blue.
But rem now when clicking on a link your user wont know if it is visited or
not visited. To achieve what you need combine this will javascript.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top