Click here to Skip to main content
14,877,543 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
my gridview having a column named Select, which contains linkbutton. i fired click event for that linkbuttons to display chart and it is working properly.now i want to call the imagebutton click event by mouseover. Is their any way to do this?

i used this code.
JavaScript
<script>
          // if you want to call on hover of link button
          $('#link buttonid').live('hover',function(){
               $('#imagebuttonid').click();
          });
 
          // if you want to call on hover of image button
          $('#imagebuttonid').live('hover',function(){
               $('#imagebuttonid').click();
          });
   </script>


but how can i take imagebutton id from gridview?

please help me.
Thanks in advance
Posted
Updated 1-Aug-13 0:41am
v2

well vineeth you have to use the javascript for that one

buttonid add attribute onmouseover="getclicked()"

in javscript

function getclicked(aa)
{
document.getelementbyid(aa).click();
}

regards........:)

so now from gridview databound method

button.attributes.add("onclick","getclicked("(button)e.row.findcontrol(buttonid).clientid")");
   
v2
Comments
vineeth raju 1-Aug-13 6:35am
   
but how can i take button id from gridview?
Dholakiya Ankit 1-Aug-13 6:50am
   
check updated
vineeth raju 1-Aug-13 7:20am
   
but cannot convert string to image button type..!
Dholakiya Ankit 1-Aug-13 7:23am
   
use ur controls vineeth this is just example.........
Hi,

You can do it with use of jquery. See below code.

JavaScript
<script>

          // if you want to call on hover of image button
          $("#<%= yourgridid %> input[type='image'][id^='yourimagebuttonid']").live('hover',function(){
               $('#<%= imagebuttonid %>').click();
          });
   </script>
   
v2
Comments
vineeth raju 1-Aug-13 6:32am
   
in gridview each linkbutton have separate id. then how can i call this?
Harshil_Raval 1-Aug-13 6:42am
   
You are right.But in grid view it is having pattern to create ids in each rows. use $("#yourgridid a[id^='your id']") instead of $('#link buttonid'). It will work.
vineeth raju 1-Aug-13 7:01am
   
your id means my imagebutton id right?
Harshil_Raval 1-Aug-13 7:03am
   
right. For image button use $("#yourgridid input[type='image'][id^='yourimagebuttonid']") see edited answer above.

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




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900