Solved

ASP.net Change image behind button on mouse hover or click

Posted on 2013-11-19
5
400 Views
Last Modified: 2013-11-19
Hi

I have an image behind each button of my navigation menu. I want to change this image
on the mouse hover or click but am not sure how to do it.
I tried testing the following event and the code didn't even run. I need a little guidance. Thanks


    Protected Sub NavigationMenu_MenuItemClick(sender As Object, e As System.Web.UI.WebControls.MenuEventArgs) Handles NavigationMenu.MenuItemClick

Msgbox "Test"
    End Sub
0
Comment
Question by:murbro
  • 3
  • 2
5 Comments
 
LVL 22

Accepted Solution

by:
plusone3055 earned 500 total points
ID: 39659236
a much simplier way of achiving this is javascript. Here is a snippet of code that will change images on MOuseover

http://snipplr.com/view/25950/

if you would like further explanation about OnMouseover function here is an excellent link

http://www.htmlgoodies.com/beyond/javascript/article.php/3470771
0
 

Author Comment

by:murbro
ID: 39659315
Hi

I am struggling to work out how to use the first example in my existing web form, whose code I have attached
SiteMaster.txt
0
 
LVL 22

Expert Comment

by:plusone3055
ID: 39659348
okay heres an example with your code

<asp:MenuItem ImageUrl="~/Resources/B1.bmp" onmouseover="this.src='Resources/B2.bmp'" onmouseout="this.src='Resources/B1.bmp'" ></asp:MenuItem>
0
 

Author Closing Comment

by:murbro
ID: 39659354
Thanks very much
0
 

Author Comment

by:murbro
ID: 39659385
Hi. Thanks for that last post. I tried to use it and got the following issue:
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/Q_28298025.html
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now