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
close icon

Right-Clicking while editing NumericUpDown control within a grid

Hi,

Whats the proper way to handling Right-Clicks on a NumericUpDown control that is in edit mode within a GridDataBoundGrid?

I got a semi working version by attaching to the current cell renderer's Control on mouse click event but it doesn't work for me everytime.

e.g
GridCurrentCell cc = _configGrid.CurrentCell;

if(_gridConfigMouseHandler == null)
{
_gridConfigMouseHandler = new MouseEventHandler(ConfigGridControlMouseHandlerHelper);
cc.Renderer.Control.MouseDown+=_gridConfigMouseHandler;
}




-- Alex


2 Replies

SR Sri Rajan Syncfusion Team April 22, 2008 02:23 AM UTC

Hi Alex,

Thank you for your interest in Syncfusion products.

Here is the sample code which displays a message when right clicking on the NumericUpDown cell while editing.


void gridDataBoundGrid1_CurrentCellStartEditing(object sender, CancelEventArgs e)
{
GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "NumericUpDown")
{
cc.Renderer.Control.MouseDown += new MouseEventHandler(Control_MouseDown);
}
}

void Control_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
{
Console.WriteLine("NumericUpDown in Editing Mode");
}
}


Please let me know if this helps.

Best Regards,
Srirajan



AM Alex Maldonado April 22, 2008 09:40 PM UTC

Thanks, it works munch better.

-- Alex


Loader.
Live Chat Icon For mobile
Up arrow icon