Display a list of hyperlinks

Last post 09-25-2007 4:04 PM by ecbruck. 1 replies.

Sort Posts:

  • Display a list of hyperlinks

    09-25-2007, 3:12 AM
    • Loading...
    • musclejj
    • Joined on 12-10-2006, 10:14 AM
    • Posts 10

    Hi everyone,

    I have a list of items i would like to display as hyperlinks in a repeater control

    I can use data list, bulleted list but how can i set the background of the selected item green upon click and

    the rest of the items remain uncolored. Can someone help me?

    If i cannot set the properties of the repeater control, can i use CSS to do it?

    Thanks a lot!

    J Smile

  • Re: Display a list of hyperlinks

    09-25-2007, 4:04 PM
    • Loading...
    • ecbruck
    • Joined on 12-30-2005, 2:39 PM
    • Des Moines, IA
    • Posts 7,603
    • Moderator
      TrustedFriends-MVPs

    Do you mean that you want to display the selected HyperLink with a Green background? If so, you need to modify the attributes of the Link. However, once a HyperLink has been selected or visited, the background color would remain as Green no matter what. 

    <asp:bulletedlist id="BulletedList1" runat="server" cssclass="BulletedList" displaymode="HyperLink"
    	target="_blank">
    	<asp:listitem text="Microsoft" value="http:\\www.microsoft.com" />
    	<asp:listitem text="ESPN" value="http:\\espn.com" />
    </asp:bulletedlist>
     
    .BulletedList A:link { background-color: Red; color: White; }
    .BulletedList A:visited { background-color: Green; color: White; }
    .BulletedList A:hover { background-color: Blue; color: White; }
    Thanks, Ed

    Microsoft MVP - ASP/ASP.NET

    protected void Post_Answered(object sender, EventArgs e) { if (this.MarkAsAnswered != null) { this.MarkAsAnswered(this, EventArgs.Empty); } }
Page 1 of 1 (2 items)
Microsoft Communities
Page view counter