Results 1 to 3 of 3

Thread: imagebutton rollover in a repeater

  1. #1

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    imagebutton rollover in a repeater

    I have some image buttons in a repeater that i want to have rollover images.

    In the past i've done this with static imagebuttons by adding:
    VB Code:
    1. btnLogin.Attributes.Add("OnMouseOver", "this.src='images/Login_over.gif';")
    2. btnLogin.Attributes.Add("OnMouseOut", "this.src='images/login_out.gif';")
    To the page_load event.

    How can i create a rollover image for an imagebutton thats in a repeater?

    Cheers,

    Tom.

  2. #2
    Lively Member
    Join Date
    Oct 2002
    Location
    Los Angeles, CA
    Posts
    73
    Basically it is the same thing.
    You write the code for something like OnItemCreated or ItemDataBound event and use Item.FindControl function to get reference for every ImBut control and apply add attribute

  3. #3

    Thread Starter
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092
    Thanks a lot split, actually a lot easy than i thought in the end. I Ended up putting the code in the on_load event for the imagebutton as such
    VB Code:
    1. Sub ImageButton_Load(ByVal sender As Object, ByVal e As System.EventArgs)
    2.         sender.Attributes.Add("OnMouseOver", "this.src='../images/enter_next_round_over.gif';")
    3.         sender.Attributes.Add("OnMouseOut", "this.src='../images/enter_next_round.gif';")
    4.     End Sub
    And everything works great, still very much getting used to asp.net but really liking it so far.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width