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.
Unfortunately, activation email could not send to your email. Please try again.

Right Click in Grid Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

59360 Apr 11,2007 01:02 PM Apr 11,2007 03:15 PM Windows Forms 2
loading
Tags: GridControl
Anupreet
Asked On April 11, 2007 01:02 PM

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.

haneefm [Syncfusion]
Replied On April 11, 2007 01:50 PM

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

Anupreet
Replied On April 11, 2007 03:15 PM

Thanks Haneef

It worked.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;