Click here to Skip to main content
15,905,558 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my gridview have linkbutton. While clicking onclick event get fired. But can i do the same thing by mouseover?


i already wrote a code for linkbutton in that gridview. but i will work by mouse click. now i want to access the same code by mouseovering.
Means, if i bring mouse pointer to first row of the gridview , i need to fire the linkbutton's onclick event. is any way to do this?

pls help...
thanks in advance
Posted
Updated 31-Jul-13 21:20pm
v3

HTML
<button id="someButton">Mouse over me!</button>


JavaScript
<script>
// The $ function is used as short-hand for document.ready function.
// http://api.jquery.com/jQuery/
$(function() {
    $("button#someButton").mouseover(function() {
        alert("Hello world");
    });
});
</script></script>
 
Share this answer
 
v2
Comments
vineeth raju 31-Jul-13 4:44am    
i already wrote a code for linkbutton in that gridview. but i will work by mouse click. now i want to access the same code by mouseovering.
Means, if i bring mouse pointer to first row of the gridview , i need to fire the linkbutton's onclick event. is any way to do this?
So you want to call server side method from client side. For this you can use jQuery's .ajax() method. For a detailed implementation and example check this[^] link.
 
Share this answer
 
Simple solution is to trigger the hyperlink click on mouse over.

for grid view you can add mouse over using :
C#
e.Row.Attributes["onmouseover"] = "ClickLink()";

ClickLink()is a javaScript function like below
C#
function ClickLisk() {
     document.getElementById('link').click(); //link is the id for <a href> tag
}

You can pass id for hyperlink as parameter of function call to trigger link dynamically.

Hope this Helps
Happy Coding :-)
 
Share this answer
 
v2
Comments
vineeth raju 1-Aug-13 3:08am    
how it will be work inside a gridview?
vineeth raju 1-Aug-13 3:16am    
my links are occupied inside of the gridview rows.
Sreejith MV 1-Aug-13 7:28am    
I updated the answer hope this will help you
vineeth raju 2-Aug-13 0:32am    
in each grid rows the id link is changing.. then how can i take the link id?
XML
use javascript will be easier

<pre lang="HTML">&lt;button id="buttonb"  önclientclick="return getbuttonbclick()" /&gt;</pre>

<pre lang="Javascript">function getbuttonbclick()
{
      document.getelementbyid(textboxa).value=document.getelementbyid(textboxb).value

}</pre>

onrowdatabound of gridview

<pre lang="c#">buttonb.attributes.add("onclick","document.getelementbyid(clientid of buttona).value=document.getelementbyid(clientid of button b).value")</pre>
inside update panel it will work fine :)


this is just example :)
 
Share this answer
 

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