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

How not to autoselect option in radiobutton cell when tabbing in grid

Heyo,

I have a grid control where I have enabled/disabled certain cells to basically provide a form for the user to fill in. Everything looks great.

Now I'm trying to make it so that if the user presses the tab key to naviagate around the grid it will only stop on editable cells. I have code that does this. However, I have a few cells that are a radio button with a single value and tabbing into these cells will auto select the option in the radio button, which I don't want it to.

All my navigation code does is iteratates through the cells left to right, top to bottom, until it finds an editable cell and then calls grid.CurrentCell.MoveTo(x,y) and grid.CurrentCell.ScrollInView(). This is being called in an override of the ProcessCmdKey().

Is there any property or method for preventing this auto selecting and requiring the user to either click on it with the mouse or press the space key or something?


TIA,

Brian

1 Reply

HA haneefm Syncfusion Team November 2, 2007 06:10 PM UTC

Hi Brian,

One way you can do this by handling the CurrentCellKeyDown event of the grid and set the e.Handled to True when Right/Left arrowkey is pressed in GridRadioButtonCell. Below is a code snippet that shows this task.

void gridCurrentCellKeyDown(object sender, KeyEventArgs e)
{
GridControl _ctlGrid = sender as GridControl;
GridCurrentCell cc = _ctlGrid.CurrentCell;

string _strCurrentCellType = _ctlGrid.Model[cc.RowIndex, cc.ColIndex].CellType;
if (_strCurrentCellType == "RadioButton")
{
switch (e.KeyCode)
{
case Keys.Right:
e.Handled = true;
cc.MoveRight();
break;
case Keys.Left:
e.Handled = true;
cc.MoveLeft();
break;
}
}
}

Best regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon