ASP.NET Repeater Control Not Working in FireFox

Posted by Robert Hyland on Stack Overflow See other posts from Stack Overflow or by Robert Hyland
Published on 2011-11-29T01:38:07Z Indexed on 2011/11/29 1:50 UTC
Read the original article Hit count: 227

Filed under:
|
|
|

everyone:

I have an ASP.NET Application that uses a Repeater control to display a thumbnail gallery. When the user mouses over one of the thumbnails, the main image will present that thumbnail.

It uses a Repeater control in a UserControl like this:

<asp:Image ID="pictureImage" runat="server" Visible="true" Width="200px" />
<asp:Repeater ID="rpProductImages" runat="server" Visible="false">
    <ItemTemplate>
        <div>
            <div style="float: left" id="smallImage" runat="server">
                <div class="smallAltImage" onmouseover="showImage();" 
                    style="border: 1px solid #999999; margin: 5px 5px 5px 4px;
                    width: 45px; height: 45px; background-position: center; background-repeat: no-repeat; 
                    background-image: url('<%#ResolveClientUrl(productImagesPath)%><%# String.Format("{0}", DataBinder.Eval(Container.DataItem, "ImageName")) %>');">
                </div>
                <asp:Label ID="lblImageName" runat="server" Visible="false"><%# Eval("ImageName")%></asp:Label>
            </div>
        </div>
    </ItemTemplate>
</asp:Repeater>

Then, in a javascript file, this:

function showImage(){
    // Get thumbnail path.
    var img = (this.style.backgroundImage).substring(4, (this.style.backgroundImage).length - 1);
    $('#ctl00_ContentPlaceHolder1_ProductDetails1_pictureImage').attr('src', img);
}

It works fine in IE9, displaying the fully-qualified path for the image. In FireFox8, however, the img src looks like this: ""ProductImages/K42JY_500.jpg"" ... with two-sets of quotes!

I think that the Repeater control is the central cause of the problem but I Googled and Googled again and could not find anyone that has experienced this similar situation!

In fact, I'll PayPal anyone who can help me solve this with $50.00 (can't you tell I'm in the XMAS spirit, here?!)

Any help is appreciated and "Thank You" in advance!

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET