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

Discussion in 'ASP .Net Web Controls' started by Don M, Jan 25, 2004.

  1. Don M

    Don M Guest

    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.
     
    Don M, Jan 25, 2004
    #1
    1. Advertising

  2. 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.




    "Don M" <> wrote in message
    news:...
    > 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.
     
    Alessandro Zifiglio, Jan 25, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jensen bredal
    Replies:
    2
    Views:
    447
    jensen bredal
    Apr 15, 2005
  2. Matt Adams
    Replies:
    0
    Views:
    925
    Matt Adams
    Aug 26, 2003
  3. Bruce Grubb
    Replies:
    1
    Views:
    499
    Stephen Adams
    May 23, 2006
  4. jalkadir
    Replies:
    2
    Views:
    404
  5. Al Cadalzo

    making hyperlink look 'visited'

    Al Cadalzo, Apr 22, 2004, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    149
    Al Cadalzo
    Apr 24, 2004
Loading...

Share This Page