Here is the tag:
<asp:Image ID="Photo" runat="server" ImageUrl="Images/Loading.gif" OnLoad="SwapImage(this,'Handler.ashx?AlbumID=<%#Eval("AlbumID")%>&Size=M');" CssClass="photo_198" style="border:4px solid white" ToolTip='<%#Eval("DESCRIPTION")%>' />
I know the problem is something with the OnLoad part of the tag. and I'm pretty sure it has to do with the single quotes around the handler url. can anyone help with this? do I need to escape out of the single quote or what?
Try this
<asp:Image ID="Photo" runat="server" ImageUrl="Images/Loading.gif" OnLoad='SwapImage(this,<%# "Handler.ashx?AlbumID=" & Eval("AlbumID")%>&"Size=M");' CssClass="photo_198" style="border:4px solid white" ToolTip='<%#Eval("DESCRIPTION")%>' />I dont have the swapImage function, so I'm not sure if it's working or not, but the error changed :)
onmouseover="<%#"javascript:clearHistory1('" & Eval("Heading") & "','" & Eval("Description") & "');"%>"
niether of those two helped, the 2nd on gives a worse error and I'm not doing a roll over image. Here is my swapImage function
<script type="text/javascript"> function SwapImage(img,src) { img.src=src; } </script>
this is what I changed the onload part to and still get the not well formed tag error:
<asp:Image ID="Photo" runat="server" ImageUrl="Images/Loading.gif" OnLoad='<%#"SwapImage(this, 'Handler.ashx?AlbumID=" + Eval("AlbumID") +"&Size=M')"%>' CssClass="photo_198" style="border:4px solid white" ToolTip='<%#Eval("DESCRIPTION")%>' />
ASP:Image is a server side control, when you specify the onload event, it's looking for a server onload event, not a JavaScript event which is client side.
<imgonload="SwapImage(this,<%# "handler.ashx?AlbumID=" & Eval("AlbumID") & "&Size=M" %>);"src="Images/loading.gif"class="photo_198"style="border:4px solid white"ToolTip='<%#Eval("Description")%>'/>
You need a client side HTML tag like above, who's onload even will fire on the client side, not the server side.
Hope this helps.
here is the other way is wrote the Onload part and got the same error:
OnLoad="SwapImage(this, 'Handler.ashx?AlbumID=<%# Eval("AlbumID") %>&Size=M')"
thanks a lot!!! It works great! I just needed to change the onload function in the swapImage function
it looks great in firefox but in IE 7.0 the animation of the loading gif never animates and just shows the first frame. The actual image load above it, but IE says there is an error on the page and says the error is "Error: object expected"
I fixed the Error but in IE I still don't get any animation from the loading.gif, anyone know why?
It's almost assurendly a problem with your handler. Can you post the code to the handler you're using to retreive the image?
the handler returns the correct image fine. The website runs perfect with animation in firefox but IE 7.0 just stops the animation of the loading.gif at the first frame
0 comments:
Post a Comment