Click here to Skip to main content
Rate this: bad
good
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 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 at 4-Feb-11 8:42am
   
+5. Excellent.
Surendra0x2 at 6-Dec-12 7:56am
   
Gr8 Solution Mam :)
Pandurang 11 at 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 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 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  

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

  Print Answers RSS
0 Maciej Los 655
1 OriginalGriff 453
2 CPallini 239
3 CHill60 180
4 Peter Leow 175
0 OriginalGriff 6,092
1 Sergey Alexandrovich Kryukov 4,898
2 Maciej Los 3,159
3 Peter Leow 3,129
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 6 Dec 2012
Copyright © CodeProject, 1999-2014
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