|
| GridView Edit Mode control cannot receive focus, and other maladies |
 |
Tue, 29 Jan 2008 17:19:49 +000 |
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.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|