ASP Image BorderColor Change on mouseover

I'm writing a .NET website using c#.  I am making a photo gallery and have the images within asp:Image components.  Here is the code for the components:
<asp:Image ID="thumbnail01" runat="server" BorderColor="Green" BorderWidth="2px" />

On mouseover, I want the image border color to change.  I tried this with no luck:
thumbnail01.Attributes.Add("onmouseover", "document.getElementById(thumbnail01').BorderColor='Red'");

I also tried this with no luck:
thumbnail01.Attributes.Add("onmouseover", "document.getElementById('thumbnail01').style.BorderColor='Red'");

And this:
thumbnail01.Attributes.Add("onmouseover", "this.BorderColor='Red'");

I also tried doing it through a stylesheet with no luck  What am I missing here?  Is there a special way to reference a BorderColor in an asp:Image?  
atuccilloAsked:
Who is Participating?
 
David H.H.LeeCommented:
Hi borderColor,
Almost there, javascript is case-sensitive.
eg:
    thumbnail01.Attributes.Add("onmouseover", "this.style.borderColor='Red';");
   

0
 
Pratima PharandeCommented:
try this

  thumbnail01.Attributes.Add("onmouseover", "document.getElementById('thumbnail01').style.borderColor='Red'");

Javascript is Case Sensative
so change BorderColor  to  borderColor as shown above
0
 
David H.H.LeeCommented:
Ooopps, too late after enter the comment...
0
 
RobbPCommented:
Instead try using JQuery
http://www.dotnetcube.com/post/Getting-started-with-JQuery-in-ASPNET.aspx

This way you can make it reusable and much more intuitive - easy to implement.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.