This is a migrated thread and some comments may be shown as answers.

Grid stealing focus when row is added

3 Answers 73 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Guy Inwhitenorth
Top achievements
Rank 1
Guy Inwhitenorth asked on 14 Jan 2010, 10:48 PM
How can I prevent the grid from stealing focus when a new item is added to the underlying collection?

For example, I have two seperate windows, one which displays the grid, another through which the user may add new rows to the grid. I would like focus to remain on the add window when the user adds a new row, but the grid by default seems to be setting focus to the first editable cell in the new row.

Thanks

3 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 15 Jan 2010, 10:17 AM
Hi Guy Inwhitenorth,

You can call the Focus method of the control that you want to focus after inserting the data item in the collection. Let me know if this does not help.

Regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Guy Inwhitenorth
Top achievements
Rank 1
answered on 15 Jan 2010, 04:21 PM
Perhaps I oversimplified my description, but no that does not help.

The control which needs to retain focus has no knowledge of the collection to which the data item is eventually added, and to which the grid is bound. They exist in seperate modules.

I need a way to disable the grid from stealing focus when a new item is added to the collection to which it is bound.
0
Rossen Hristov
Telerik team
answered on 21 Jan 2010, 09:48 AM
Hello Guy Inwhitenorth,

Unfortunately, there is no way to prevent this unless you manually focus something else at the moment your user does something to insert a new item. I guess that that the user does something on the control that needs to remain focused, so I think it there you should focus this control. The other option would be to set the Focusable property of the grid to false. Maybe this will help.

By the way, I have prepared a little sample project in trying to reproduce the issue you are having, but in my project the grid never receives the focus when a new item has been added. Can you please examine my sample project and modify it in way to reproduce the behavior you are experiencing. When you click the button to insert a new item it gets to focus the first time and focus stays there -- it never goes to the grid.

What should I do to make the grid get focus when a new data item is inserted?

I am looking forward to hearing from you.

Kind regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Guy Inwhitenorth
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Guy Inwhitenorth
Top achievements
Rank 1
Share this question
or