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

Right Click in Grid Cell

I have a data grid, with celltype defined as currency. While editing this cell or typing any value, if user right clicks in the same cell I need to set a customized Context Menu. As of now a general windows context meny appears for the selected text because while the cell is in edit mode the GridCurrencyTextBox control's event do not fire.

2 Replies

HA haneefm Syncfusion Team April 11, 2007 05:50 PM UTC

Hi Anupreet,

One way you can do this by handling the GridCurrencyTextBox. MouseDown event and display the context menu for editing currency cell. Here is a code snippet to show this.

//Form_Load event.
GridCurrencyTextBoxCellRenderer cr = this.gridControl1.CellRenderers["Currency"] as GridCurrencyTextBoxCellRenderer;
GridCurrencyTextBox gct = cr.Control as GridCurrencyTextBox;
if( gct != null )
gct.MouseDown +=new MouseEventHandler(gct_MouseDown);

private void gct_MouseDown(object sender, MouseEventArgs e)
{
GridControl grid = ((Control)sender).Parent as GridControl;
if( grid != null )
{
if( grid.CurrentCell.IsEditing && e.Button == MouseButtons.Right )
contextMenu.Show("Welcome");
}
}

Best regards,
Haneef


AN Anupreet April 11, 2007 07:15 PM UTC

Thanks Haneef

It worked.

Loader.
Live Chat Icon For mobile
Up arrow icon