Click here to Skip to main content
12,300,607 members (51,650 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
how we change image in image button on mouseclick in asp.net
Posted 4-Feb-11 2:22am
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

use jquery

$(function () {
 
$("#my_image").bind("click", function() {
      $("#my_image").attr("src","second.jpg");
});
 
});


or javascript

document[img_name].src = img_src;


Hope this helps...
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Your question is not clear and if I did understand clearly

<asp:ImageButton runat="server" ImageUrl="SomeImage.gif"
OnClick="Image1_Click"/>
Protected void Image1_Click(ObjectSender, ImageClickEventArgs e) 
{
  Image1.ImageUrl="NewImage.gif";
}
  Permalink  
Comments
Marcus Kramer 4-Feb-11 8:42am
   
+5. Excellent.
Surendra0x2 6-Dec-12 7:56am
   
Gr8 Solution Mam :)
Pandurang 11 25-Jan-13 3:50am
   
how genrate the NewImage.gif onclick event
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

<asp:imagebutton id="ImageButton1" runat="server" class="Login-Image-Login" onclick="Home_Click" height="30px" width="200px" xmlns:asp="#unknown">
ImageUrl="~/Images/Home.png" onmouseover="this.src='../Images/HomeClick.png';" onmouseout="this.src='../Images/Home.png';" CausesValidation="false" />
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

what if i want the previous image on next click?
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160525.2 | Last Updated 10 Aug 2015
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100