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

TAB key in DataBoundGrid

How could I make the TAB key to move to the next row in a DataBoundGrid? Currently my DataBoundGrid has the "LitBoxSelectionMode" set to One so that each time user clicks on the grid the row gets selected. I also set e.ColIndex = 0; in CurrentCellActivating. The grid works nicely, but the tab key does not work. I would like to have the tab key move to the next row. I tested the sample code in the following Knowledgebase Issue: Q10441 - Info: How do I catch the "TAB" key when the current cell is in edit mode? The code in ProcessCmdKey did not execute when I pressed the TAB key. How could I catch the TAB key? Thnak you, Marju

4 Replies

Administrator February 3, 2005 04:16 PM UTC

Marju, Try also setting grid.WantsTabKey = false Stefan >How could I make the TAB key to move to the next row in a DataBoundGrid? > >Currently my DataBoundGrid has the "LitBoxSelectionMode" set to One so that each time user clicks on the grid the row gets selected. I also set e.ColIndex = 0; in CurrentCellActivating. The grid works nicely, but the tab key does not work. I would like to have the tab key move to the next row. > >I tested the sample code in the following Knowledgebase Issue: Q10441 - Info: How do I catch the "TAB" key when the current cell is in edit mode? The code in ProcessCmdKey did not execute when I pressed the TAB key. How could I catch the TAB key? > >Thnak you, Marju

Administrator February 3, 2005 04:27 PM UTC

Hi Stefan, I tried setting grid.WantsTabKey = false, but the code in ProcessCmdKey did not run. Is there a different way to handle the TAB key? I''m also setting e.ColIndex = 0; in CurrentCellActivating. Does this make a diference? (I already tried the code with out e.ColIndex = 0, but ProcessCmdKey did not run) Thank you, Marju >Marju, > >Try also setting > >grid.WantsTabKey = false > >Stefan > >>How could I make the TAB key to move to the next row in a DataBoundGrid? >> >>Currently my DataBoundGrid has the "LitBoxSelectionMode" set to One so that each time user clicks on the grid the row gets selected. I also set e.ColIndex = 0; in CurrentCellActivating. The grid works nicely, but the tab key does not work. I would like to have the tab key move to the next row. >> >>I tested the sample code in the following Knowledgebase Issue: Q10441 - Info: How do I catch the "TAB" key when the current cell is in edit mode? The code in ProcessCmdKey did not execute when I pressed the TAB key. How could I catch the TAB key? >> >>Thnak you, Marju

Administrator February 3, 2005 08:50 PM UTC

Hi Marju, Here is some code snippet to handle this in grid''s keydown. private void gridDataBoundGrid1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e) { if(e.KeyCode == Keys.Tab) { this.gridDataBoundGrid1.CurrentCell.MoveDown(1, false); } } Regards, Jay N

Administrator February 3, 2005 10:37 PM UTC

Thank you. The code works great. Marju
Loader.
Live Chat Icon For mobile
Up arrow icon