Forum  General Visual ...  How do I...?  DataGridView and TAB vs Enter
Previous Previous
 
Next Next
New Post 10/10/2011 11:56 AM
Unresolved
  jorge.perez@enetcity.com
2 posts
No Ranking


DataGridView and TAB vs Enter 

Dear all,

I am sure someone already fixed this problem. Sorry for asking again! Scenario: I have a datagrid with several rows and 5 columns. All columns are read only except for column # 4. When the user is positioned at row 0 and column 4 ; I was able to pragmatically move focus to next row column 4, only when the user enters "ENTER key".  When the user enters the "TAB" key it moves to same row and column 5. It would not obey my new current cell = next row and column 4.

Can you help?  This is urgent....thanks

 

George

 
New Post 10/10/2011 11:37 PM
  Valter.Venturini
131 posts
5th Level Poster


Re: DataGridView and TAB vs Enter 

Hi,

I am not sure I have understood properly, but I try to give a possible solution.

If you want to disable navigation with tab (and consequentially with arrow and other keys) you have to set the grid property DisableNavigation to true.

Remember that Enter key moves the cell activation to the next row cell with the same column number. So starting from column #4 it always moves to the next row, independently if a column.

Be careful, if you set DisableNavigation to true, all the native navigation keys handlers of the grid are lost. So you have to re-implement the key event handlers.

Did I answer your question?

Daniele


R&D Team - Italstudio
 
New Post 10/11/2011 11:15 AM
  jorge.perez@enetcity.com
2 posts
No Ranking


Re: DataGridView and TAB vs Enter 

Hi Daniele,

Thank you so much for your answer. I have had many problems trying to use DataGrid for data entry. This case is really simple; several rows with 5 columns. All columns are read only except for one. All I need is that when the user enters any key "enter", "tab", "key down" that the focus goes to the next row to the only column that is NO read, ready for entering and editing new data. Very simple and tribial functionality that I have used with other technologies.

I will test your suggestion. In the mean time if you have any ideas of how to accomplish the above functionality I would appreciate your input a lot!

Kind regards,

George

 
New Post 10/12/2011 3:30 AM
  Valter.Venturini
131 posts
5th Level Poster


Re: DataGridView and TAB vs Enter 
Modified By Valter.Venturini  on 10/12/2011 8:49:10 AM)

Hi,

to accomplish your task I suggest you to handle the keypress event of the grid. With the event args you can obtain the key pressed and then you can distinguish the execution by the key.

But I do not know if you can set the cell in edit mode directly from code.

Let me know about your progress and if you still have problems feel free to ask!

Daniele


R&D Team - Italstudio
 
New Post 10/15/2011 4:03 AM
  palli
14295 posts
1st Level Poster




Re: DataGridView and TAB vs Enter 

Hi George,

Welcome to Visual WebGui

I see that Daniele already stepped in for help here, thanks Daniele.

Daniele has recently gone through similar DataGridView navigational scenario and you can find some code fragments within threads here and here. In addition to what Daniele already told you, you should pay attention to the usage of the SetFocused method, as some browsers may loose the focus if you are both setting focus to a cell as well as updating something within the control.

More info on DataGridView can be found here.

Hope thls helps,

Palli

 


Páll Björnsson - Visual WebGui support team - Email: support@visualwebgui.com
 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  DataGridView and TAB vs Enter
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS