This is a migrated thread and some comments may be shown as answers.

How to differenciate Mouse left and right click

2 Answers 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
sathies
Top achievements
Rank 1
sathies asked on 30 Mar 2009, 07:11 AM
Hi,
    I want to perform two actions, one on left click of mouse and another on right click of mouse.Any one  of the action should takes place on row click of the grid.
Please provide me some examples.

regards
sathies

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 30 Mar 2009, 08:20 AM
Hi Sathies,

Try the following logic to differentiate between Mouse left click and right click.

ASPX:
 
 <telerik:RadGrid ID="RadGrid1" runat="server" OnMouseDown="OnMouseDown(event);" > 

JS:
 
<script type="text/javascript" > 
  function OnMouseDown(e) 
  { 
       if(e.button=="2"
       { 
        alert('right clicked'); 
        //do the function here 
        } 
        else if(e.button=="1"
        { 
           alert('left clicked'); 
             //do the corresponding function here 
        } 
  } 
 
</script> 


Thanks
Shinu
0
Ali
Top achievements
Rank 1
answered on 05 Sep 2013, 09:57 AM

Hi,

I have used this method to detect if right click was clicked or left click.
I have done this inside the js file, not aspx, because I need these values for further actions. How can I pass eventArgs through so I can get the row index of the row?


Thanks.
Tags
Grid
Asked by
sathies
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ali
Top achievements
Rank 1
Share this question
or