Prevent selection of next item on combobox cell doubleclick?

Is there a way to prevent a grid cell whose CellType is "ComboBox" from selecting the next item in its DataSource when the cell is double-clicked?


2 Replies

MS Maxim Software Systems September 28, 2010 03:41 PM UTC

Sorry, I didn't realize this was under the ASP.NET forums.



NR Nirmal Raja Syncfusion Team October 6, 2010 01:09 PM UTC

Hi,

Thank you for your interest in Syncfusion products.

The double clicking of the combo box cell which changes the values can be canceled by overriding the OnEditPartMouseDown and OnDoubleClick from the GridComboBoxCellRenderer, then add the renderer to the current grid's combo box cell renderer.

Please refer the code below:
//Assigning the custome renderer
gridControl1.CellRenderers["ComboBox"] = new CustomDropDownRenderer(gridControl1, gridControl1.CellModels["ComboBox"]);

//The custome renderer class
public class CustomDropDownRenderer : GridComboBoxCellRenderer
{
public CustomDropDownRenderer(GridControlBase grid, GridCellModelBase model)
: base(grid, model)
{
}
protected override void OnEditPartMouseDown(object sender, MouseEventArgs e)
{
//base.OnEditPartMouseDown(sender, e);
}
protected override void OnDoubleClick(int rowIndex, int colIndex, MouseEventArgs e)
{
//base.OnDoubleClick(rowIndex, colIndex, e);
}
}

Also please refer the sample modified from our sample browser attached below, which illustrates the mentioned behavior:
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=DropDownSelection-131758482.zip

Let me know if you have any queries.

Regards,
Nirmal


Loader.
Up arrow icon