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

SetFocus OnPageIndexChanged

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aaron
Top achievements
Rank 1
Aaron asked on 13 Mar 2009, 03:10 PM

Is it possible to change the focus of a page to the top pager on a grid, or a textbox just above the grid, client side prior to firing the server events when using the bottom pager to switch pages?


I can use something like this on the server side,

 

ScriptManager.

SetFocus(focusOnControl);

to set the focus to the top of my page, but the page actually jumps about a third of the way up the page and then goes the rest of the way to the top of the page to set the focus.  I want the focus to be set in one step, without the delay, is that possible? 

 

 

Thank you

1 Answer, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 16 Mar 2009, 04:00 PM
Hello Aaron,

Note that if you set focus to a control client-side and then perform a postback, the focus will be lost. Therefore I suggest that you use the preceding code to set focus on the server. If you prefer setting it client-side, then do it in the pageLoad() handler. 
And in order to prevent the page from "jumping", you could try setting the MaintainScrollPositionOnPostBack property of the Page to false, and see if this helps.

Check it out and let me know how it goes.
 
Kind regards,
Iana
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Aaron
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Share this question
or