WrapCellBehavior - same row

Is there a way to control tabbing in a GridDataBoundGrid so that when the user is in the last column in any row and presses the Tab key, he/she is sent to the first cell in the same row?
And, similarly, if the Shift+Tab keys are pressed and they are in the first cell, they go to the last cell in the same row?

I was hoping that one of the enums for WrapCellBehavior might be something like WrapCurrentRow.

Thanks for any help on this,
Mark


2 Replies

RC Rajadurai C Syncfusion Team October 17, 2008 11:13 AM UTC

Hi Mark,

Thanks for your interest in Syncfusion products.

Please try the following code in CurrentCellKeyDown event handler in GridDataBoundGrid to achieve this feature.



//assuming grid containing 'n' columns

GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
if(e.Shift == false && e.KeyCode == Keys.Tab && cc.ColIndex == n)
{
cc.MoveTo(cc.RowIndex,1,GridSetCurrentCellOptions.SetFocus);
e.Handled = true;
}
else if(e.Shift == true && e.KeyCode == Keys.Tab && cc.ColIndex == 1)
{
cc.MoveTo(cc.RowIndex,n,GridSetCurrentCellOptions.SetFocus);
e.Handled = true;
}



Regards,
Rajadurai



AD Administrator Syncfusion Team October 17, 2008 03:20 PM UTC

Rajadurai,
That works great! Thanks for your help.

Mark


Loader.
Up arrow icon