ASP.NET 2.0: onmouseover

  • Thread starter Bendik Engebretsen
  • Start date
B

Bendik Engebretsen

Hi,

ASP.NET newbie has just started expermenting with VS.NET 2005 Beta, ASP.NET
2.0 and the 'Personal WEB site' starter kit. I am now trying to create a
rollover effect on the buttons. I have tried adding onmouseover/onmouseout
events in my .skin file like this:

<asp:imagebutton runat="server" Imageurl="Images/button-login.gif"
onmouseover="this.src='Images/button-login_hot.gif'"
onmouseout="this.src='Images/button-login.gif'" skinid="login"/>

When I move the cursor over the 'Login' button the image disappears, I just
get the red X and text. What could be wrong ?

Bendik
 
G

Grant Merwitz

It could be that you are using relative Image links

Try changing the Image links to:
/Images/button-login.gif (thats if the Image folder is in the root of
your website)

If you are using a Virtual Directory, try changing to
~/Images/button-login.gif (again, if Images is in the root of the
folder)

Hope thats helps
 
B

Bendik Engebretsen

Thanks!

I understand now that my path is wrong. I thought that I could use the same
relative path as with the 'Imageurl' property, but obviously 'this.src'
works differently. I got away with the following:

onmouseover="this.src='App_Themes/MyTheme/Images/button-login.gif'"

It's not the ideal solution, because if I want to switch the skin from
MyTheme to something else, I'll have to rewrite all the buttoncode in the
..skin file. Any ideas how to solve this in a more elegant fashion ?

Bendik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top