Question Need Help with imageButton rollover image inside repeater

nthoeming

New member
Joined
Apr 30, 2012
Messages
3
Programming Experience
1-3
I'm trying to add roll-over images to my imageButtons inside a repeater using the various techniques I've found online.
Essentially, my initial artwork ends in I.png and my hover artwork ends in H.png. All of the paths and attributes are being inserted correctly.

From the Page:
VB.NET:
            <asp:Repeater ID="Repeater1" runat="server" DataSourceID="GatewayDataSource" OnItemDataBound="Repeater1_OnItemDataBound">
                <ItemTemplate>
                    <asp:ImageButton ID="ImageButton1" runat="server" 
                    ImageUrl='<%# "~/Images/Gateways/" & Eval("artworkInitial") %>' 
                        PostBackUrl='<%# Eval("domain") & Eval("redirect") %>' ToolTip='<%# Eval("toolTip") %>' CssClass="GatewayArtwork" />
                </ItemTemplate>
            </asp:Repeater>
The Code Behind:
VB.NET:
    Protected Sub Repeater1_OnItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs)
        Dim Button As ImageButton = CType(e.Item.FindControl("ImageButton1"), ImageButton)
        Dim Iurl As String = Button.ImageUrl
        Dim Hurl As String = Iurl.Substring(0, Iurl.Length - 5)
        Hurl &= "H.png"
        Button.Attributes.Add("OnMouseOut", "this.src='" & Iurl & "';")
        Button.Attributes.Add("OnMouseOver", "this.src='" & Hurl & "';")
    End Sub

I believe my problem is that when the page is rendered, the apostrophes in my OnMouseOut and OnMouseOver are being replaced with (& # 3 9 ; ) - Obviously, that should all run together, but pasting it here caused it to be replaced with an actual apostrophe...which is what should be happening in my case.

Screenshot of Firefox View Source code as PNG and JPG:



Thanks in advance!
 

Attachments

  • Screenshot.png
    Screenshot.png
    3.8 KB · Views: 24
  • Screenshot.jpg
    Screenshot.jpg
    18 KB · Views: 21
Last edited:
Top Bottom