On a pop-up page I had two gridviews. One allowed for entering comments.
Most gridview events worked fine -- delete, add, cancel edit, update and get into edit mode.
The problem was when I put my cursor into the textbox for the comments field to edit. That caused a postback (?!?) with the SELECT row command, and the net effect was to disallow my cursor placement to take effect and allow me to update the comments. (?!?)
The solution was to force setting focus at the end of the RowEditing event. That turned the trick and short-circuited the SELECTion altogether.
GridView.Rows(e.NewEditIndex).FindControl(
"txtComment").Focus()
Thanks to JOTEKE at //aspadvice.com/blogs/joteke.
I post my findings here in the hopes someone who needs this solution and who is unable to find it without the key word 'focus' will be able to do so.
None
0 Points
2 Posts
GridView Edit Mode control cannot receive focus, and other maladies
Jan 29, 2008 12:19 PM|BobSullentrup|LINK
Folks,
I had the following problem:
On a pop-up page I had two gridviews. One allowed for entering comments.
Most gridview events worked fine -- delete, add, cancel edit, update and get into edit mode.
The problem was when I put my cursor into the textbox for the comments field to edit. That caused a postback (?!?) with the SELECT row command, and the net effect was to disallow my cursor placement to take effect and allow me to update the comments. (?!?)
The solution was to force setting focus at the end of the RowEditing event. That turned the trick and short-circuited the SELECTion altogether.
GridView.Rows(e.NewEditIndex).FindControl(
"txtComment").Focus()Thanks to JOTEKE at //aspadvice.com/blogs/joteke.
I post my findings here in the hopes someone who needs this solution and who is unable to find it without the key word 'focus' will be able to do so.
GridView Custom Control ITemplate Toolkit