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

Problem in Double Click event of RadGrid

3 Answers 179 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zeeshan
Top achievements
Rank 1
Zeeshan asked on 21 Aug 2013, 03:41 PM
Hi Guys,
I am using AJAX toolkit Q2 2013 version of Telerik AJAX controls. I am using RadGrid control and I am facing problem of Double click event on GridView Row. My scenario is give below:

 I am using RadGrid control in my page. I am using Drag&Drop feature of RadGrid view. I am firing Gridview Client side Event "OnRoDragStarted" and "OnRowDbClick" event. I am facing problem that when I double click on my GridView Row, it fires "OnRoDragStarted" and then "OnRowDbClick" event. Can anybody guide me that how I can avoid "OnRoDragStarted" event on Double Click Event of Gridview Row. Thanks in advance.

Regards,

3 Answers, 1 is accepted

Sort by
0
Deyan Enchev
Telerik team
answered on 26 Aug 2013, 11:35 AM
Hi Zeeshan,

It is expected behavior OnRowDragStarted to be fired before OnRowDblClick event. It is possible to prevent  firing of OnRowDragStarted event based on some condition as it is shown below:

<script type="text/javascript">
function OnRowDragStarted(sender, eventArgs)
{    
    if(some condition)
    {
        eventArgs.set_cancel(true) //cancel the event
    }    
}
 
</script>

However this will disable also DragAndDrop functionality of RadGrid. You can find more information about this event here.

Regards,
Deyan Enchev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Zeeshan
Top achievements
Rank 1
answered on 30 Aug 2013, 01:27 PM
Hi Deyan 

Thanks for your response regarding RadGrid double click event. Is there any property in eventArgs which can distinguish that weather item is going to drag or just double click on Row. I've checked eventArgs.get_gridDataItem().get_id() property, but in both cases this property return same value. Can you please tell me that on which property in eventArgs, we can distinguish that weather drag is going to start or we just double click? Thanks in advance.

Regards,
0
Deyan Enchev
Telerik team
answered on 03 Sep 2013, 07:27 AM
Hello Zeeshan,

When you are starting to do a Drag&Drop there is no way for the event to know is this action going to be D&D only or it will be double click.

Still there might be a solution for your case and it would be using the setTimeout method shown in msdn code library. You can use this method for setting timeout (e.g. 50 or 100ms) on the OnRowDragStarted event and there to set a boolean variable, which will indicate if  OnRowDblClick event is fired or not. This will let you distinguish between started Drag event and a double click event.

Regards,
Deyan Enchev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Zeeshan
Top achievements
Rank 1
Answers by
Deyan Enchev
Telerik team
Zeeshan
Top achievements
Rank 1
Share this question
or