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

FocusControl() not working in IE7

4 Answers 109 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Stefan Kamphuis
Top achievements
Rank 2
Stefan Kamphuis asked on 23 Nov 2011, 10:07 PM
Hi,

I have a DotNetNuke module with quite some controls being loaded dynamically. Each of the input controls has autopostback set. In practice, a user will tab to a next control.

In javascript, I put the ID of the newly focussed control in a hidden field.
Then autopostback occurs, and I use RadAjaxManager.FocusControl() to set the focus to the control in the hidden field.

This works just fine in FireFox and IE9, but doesn't work in IE7 (or IE9 with compatibility mode set to true).

Any ideas?

Thanks!
Stefan Kamphuis

4 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 24 Nov 2011, 02:25 PM
Hello Stefan,

Can you elaborate on what are the input controls, are they ASP:TextBox or RadInput or another type of control? Also, is it possible that some javascript error is thrown in IE that is preventing the control from focus?

Greetings,
Iana Tsolova
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
Stefan Kamphuis
Top achievements
Rank 2
answered on 24 Nov 2011, 08:58 PM
Eleborating a bit always helps :-). But didn't solve it yet though...

All controls are RadInput Controls. I just had a look at the value passed to the FocusControl method in different browsers.
For IE7 that's, in a certain example: blablabla_ctl02_ctl00_Area4DecimalsTextBox
Whereas in all other browsers, it is: blablabla_ctl02_ctl00_Area4DecimalsTextBox_text

I guess that explains why it's not working.

Would it be safe to append _text to the name if it doesn't end with that?
0
Iana Tsolova
Telerik team
answered on 25 Nov 2011, 12:15 PM
Hi Stefan,

Yes, if you are using RadInputs with non-single input rendering, you should append "text" to the client id of the control. See the below resources:
http://www.telerik.com/help/aspnet-ajax/input-setting-focus.html
http://demos.telerik.com/aspnet-ajax/ajax/examples/common/settingfocus/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/input-breaking-changes.html

Kind regards,
Iana Tsolova
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
Stefan Kamphuis
Top achievements
Rank 2
answered on 25 Nov 2011, 03:05 PM
Yes, I read about that before too, but what surprises me, is that my previous solution works in mnost browser, except for older IE versions.

Anywa, happy to have it working now.

Thanks
Tags
Ajax
Asked by
Stefan Kamphuis
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
Stefan Kamphuis
Top achievements
Rank 2
Share this question
or