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

Lost focus and interruption with RadAjax

2 Answers 82 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Safa
Top achievements
Rank 1
Safa asked on 07 Nov 2012, 12:40 AM
I have a data entry form with lots of textboxes and Radcombo boxes on it. The user changes the values for the textboxes and uses tab button or mouse to move to other controls, randomly. There is no 'Save' functionality on the page, so with each update, I send an ajax request to update the server and save the values. The problem is with each ajax call back, there is a slight refresh of the page, and the focus is lost. I know I can use FocusControl() function to set the focus, but, for example, I am using onblur event for textboxes, and by the time the event is raised, the focus is on some other control, which can be anywhere on the form, and I have no clue where to put the focus on. And even if I knew, imagine the user has already opened a combobox, and is half way scrolling down the items when the focus is lost, and he has to open it again. So it gets really bumpy.

Basically, I am looking for a way to send ajax calls back to server without interrupting the user at all, like a second thread. I have allocated a separate AjaxPanel to it without any controls in it, just to make the call, but it still interrupts the user.

Thanks for your help.

2 Answers, 1 is accepted

Sort by
0
Angel Petrov
Telerik team
answered on 09 Nov 2012, 01:24 PM
Hello Safa,

Please note that the required functionality is not supported by the MS Ajax framework. When the ajax request is initiated the page life cycle will repeat. This means that the processing steps - initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering will take place. So it is normal to lose focus over the control. You can regain the focus by intercepting which control initialized the ajax request and set the focus back after the request finishes. 

All the best,
Angel Petrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Safa
Top achievements
Rank 1
answered on 09 Nov 2012, 03:12 PM
Thank you Angel.
So there's no way to do it in real time. I think I'll keep the updated values somewhere on the client, and wait for the next call back to happen (for other reasons) and update the server.

Regards,
Safa
Tags
Ajax
Asked by
Safa
Top achievements
Rank 1
Answers by
Angel Petrov
Telerik team
Safa
Top achievements
Rank 1
Share this question
or