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

Detect the trigger for row selection in OnRowSelecting event

3 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Val
Top achievements
Rank 1
Val asked on 08 Jan 2009, 01:54 AM
How do I detect if the OnRowSelecting client side event was triggered by the GridClientSelectColumn checkbox or by clicking on the row (outside the checkbox)?

I found a few posts but they don't seem to apply to the new grid version.

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 08 Jan 2009, 04:22 AM
Hi Val,

Try the following code snippet to find whether clicked on "CheckBox" or outside CheckBox when selecting the row. Hope this help you.

JavaScript:
<script type="text/javascript"
function OnRowSelected(sender, args) 
    var e = args.get_domEvent(); 
    //IE - srcElement, Others - target 
    var targetElement = e.srcElement || e.target;                 
    //is the clicked element an input checkbox? <input type="checkbox"...> 
    if(targetElement.tagName.toLowerCase() != "input" && (!targetElement.type || targetElement.type.toLowerCase() != "checkbox"))// && currentClickEvent) 
    { 
        alert("Clicked on Row"); 
    } 
    else 
    { 
        alert("Clicked on CheckBox"); 
    } 
</script> 

Thnaks,
Shinu.
0
Val
Top achievements
Rank 1
answered on 09 Jan 2009, 03:38 PM
Shinu,

Thank you, that worked.
0
Basel Nimer
Top achievements
Rank 2
answered on 02 May 2010, 01:38 PM
Thanks
Tags
Grid
Asked by
Val
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Val
Top achievements
Rank 1
Basel Nimer
Top achievements
Rank 2
Share this question
or