We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

In GridDataBoundGrid control, CurrentCellControlDoubleClick event is being fired when we double click with mouse right button. We need this event only when we double click with mouse left button. How can we achieve this?

Hi,

Here is a GridDataBoundGrid 'gridDataBoundGrid1'.It has three columns(Name, Location and Amount);
Static columns: Name and Location.
Dynamic columns: Amount column contains Textbox control.

How i have implemented?
Took two events
1)this.gridDataBoundGrid1.CellDoubleClick +=new GridCellClickEventHandler(gridDataBoundGrid1_CellDoubleClick);
2)this.gridDataBoundGrid1.CurrentCellControlDoubleClick +=new ControlEventHandler(gridDataBoundGrid1_CurrentCellControlDoubleClick);

The first event fires when we double click on static columns whereas second event fires when we double click on dynamic columns (columns which contains controls). Second event fires only when the control in the cell contains focus only.

1) When i right double click on static columns it should not display the message, that i have fixed by adding code
"if(e.MouseEventArgs.Button != MouseButtons.Right)"
{
MessageBox.Show("Double Click");
}

2) How can i prevent from showing message when user right double clicks on control based columns(Amount)?

Below is the attchment for this example.

Thanks
Raghavendra

SampleGridExp.zip

2 Replies

HA haneefm Syncfusion Team August 6, 2007 05:56 PM UTC

Hi Raghavendra,

You can use the Control.MouseButtons property to find mouse button when double click inside the grid textbox cell. Below is a code snippet

private void gridDataBoundGrid1_CurrentCellControlDoubleClick(object sender, ControlEventArgs e)
{
if (Control.MouseButtons != MouseButtons.Right)
{
MessageBox.Show("Current cell control double click" );
}
}

Best regards,
Haneef


RA Raghav August 7, 2007 04:42 AM UTC

Thank you Haneef, it works fine.

Thanks
Raghavendra

Loader.
Live Chat Icon For mobile
Up arrow icon