Please Help!! Big Issue for our clients!
5 Answers, 1 is accepted
Hello Stephanie,
A common reason for such behavior is focus being set to the textbox too early. Sometimes browsers do not calculate the absolute position of this textbox in the RadWindow's iframe and consider it to be the beginning of the form, so they attempt to scroll it into view and this pushes the RadWIndow titlebar out of the viewport.
To avoid this, you can try focusing the textbox with a small timeout on the client, instead of the server Focus() method. For example:
function
focusMyTextBox() {
setTimeout(
function
() {
$get(
"<%=myTextBox.ClientID%>"
).focus();
}, 0);
Sys.Application.remove_load(focusMyTextBox);
}
Sys.Application.add_load(focusMyTextBox);
where you can try increasing the timeout. Another option would be to call the center() method of the RadWindow after focusing the textbox if this does not help as-is.
Regards, Marin Bratanov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
Hello Stephanie,
This behavior is really odd. Can you confirm that you have replaced myTextBox with the actual ID of the textbox you want focused? Have you tried calling the RadWindow's center() method after the focus() call, as well as calling center() with a timeout, e.g.:
function
focusMyTextBox() {
setTimeout(
function
() {
$get(
"<%=myTextBox.ClientID%>"
).focus();
setTimeout(
function
() {
GetRadWindow().center();
}, 300);
}, 0);
Sys.Application.remove_load(focusMyTextBox);
}
Sys.Application.add_load(focusMyTextBox);
The problem is that there are no events fired when the keyboard shows, so we cannot know when this happens, how long it takes and what is the change to the screen, so you can fiddle with the nested timeout as well. You may also find interesting this approach from StackOverflow for getting back the content to the initial scrolling position: http://stackoverflow.com/questions/2593139/ipad-web-app-detect-virtual-keyboard-using-javascript-in-safari. You may need to change the scrollTop of the parent page (http://www.telerik.com/help/aspnet-ajax/window-programming-calling-functions.html) and perhaps store the original offset before focusing the textbox.
You can also try recentering/resizing/moving the RadWIndow when the viewport size changes as shown here: http://www.telerik.com/support/kb/aspnet-ajax/window/details/setting-size-in-percent-for-the-radwindow.
Regards,
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.