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

attempt to right-click on a column header to display a context menu sorts the ggc instead

I would like to right click on the ggc column header to display a context menu to execute a command. However, right-clicking on the column header sorts the column instead. How can I make only left-click sorts the ggc and right click display a context menu.

1 Reply

AD Administrator Syncfusion Team January 25, 2007 09:33 AM UTC

Hi James,

Thank you for being patience.

Please try using the following code snippet to achieve the intend behavior. This can be achieved by handling the TableControlCellMouseDown event. In the event, the context menu is shown on right click.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//this.gridGroupingControl1.TableControlCellMouseDown += new GridTableControlCellMouseEventHandler(gridGroupingControl1_TableControlCellMouseDown);
void gridGroupingControl1_TableControlCellMouseDown(object sender, GridTableControlCellMouseEventArgs e)
{
GridTableCellStyleInfo style = e.TableControl.Table.TableModel[e.Inner.RowIndex, e.Inner.ColIndex];
if (style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell)
{
if (e.Inner.MouseEventArgs.Button == MouseButtons.Right)
{ menu.Show(this.gridGroupingControl1, e.Inner.MouseEventArgs.Location);
e.Inner.Cancel = true;
}
}
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Kindly let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon