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

GDBG - read only cell.

Hi, can anybody help me with following problem. In GDBG when i click on the cell with mouse, i''m immediately entering into edit mode. How can i change behaviour of the grid to following: 1. When user first click on cell - just select the cell. 2. When user click on the selected cell - then enter to edit mode. Thank you.

1 Reply

AD Administrator Syncfusion Team June 2, 2004 05:13 AM

The grid.ActivateCurrentCellBehavior property is what controls this cell editing activation. The default is to activate it when you click on a cell which is what you are seeing now. If you set it to None or set it to DblClkOnCell, then single clicking the cell will not activate it. To get it to activate on the second single click of the same cell, I think you will have to handle some events and sets some flags to try to isolate this seconde click. Here are some snippets that seem to work for me.
int lastCurrentCellRowIndex = -1;
int lastCurrentCellColIndex = -1;

private void gridDataBoundGrid1_CurrentCellMoved(object sender, GridCurrentCellMovedEventArgs e)
{
	if(Control.MouseButtons != MouseButtons.Left)
	{
		GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
		this.lastCurrentCellRowIndex = cc.MoveToRowIndex;
		this.lastCurrentCellColIndex = cc.MoveFromColIndex;
	}
}

private void gridDataBoundGrid1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(lastCurrentCellRowIndex  == cc.RowIndex && lastCurrentCellColIndex == cc.ColIndex)
		this.gridDataBoundGrid1.ActivateCurrentCellBehavior = GridCellActivateAction.ClickOnCell;
	else
		this.gridDataBoundGrid1.ActivateCurrentCellBehavior = GridCellActivateAction.None;
	this.lastCurrentCellRowIndex = cc.RowIndex;
	this.lastCurrentCellColIndex = cc.ColIndex;
}

Loader.
Live Chat Icon For mobile
Up arrow icon