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

Posted on 2013-11-19
Medium Priority
Last Modified: 2013-11-19

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
Question by:Murray Brown
  • 3
  • 2
LVL 22

Accepted Solution

plusone3055 earned 2000 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


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


Author Comment

by:Murray Brown
ID: 39659315

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

Expert Comment

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>

Author Closing Comment

by:Murray Brown
ID: 39659354
Thanks very much

Author Comment

by:Murray Brown
ID: 39659385
Hi. Thanks for that last post. I tried to use it and got the following issue:

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

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.

Join & Write a Comment

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…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
This video tutorial shows you the steps to go through to set up what I believe to be the best email app on the android platform to read Exchange mail.  Get the app on your phone: The first step is to make sure you have the Samsung Email app on your …
Watch the video to know the simple way to remove or recover or reset lost or forgotten passwords of Outlook PST file. With Kernel Outlook Password Recovery tool such operation is very easy to perform. It is a freeware with limitation to use with 500…

607 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