FocusControl() not working in IE7

5 posts, 0 answers
  1. Stefan Kamphuis
    Stefan Kamphuis avatar
    15 posts
    Member since:
    May 2008

    Posted 23 Nov 2011 Link to this post

    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
  2. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 24 Nov 2011 Link to this post

    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
  3. Stefan Kamphuis
    Stefan Kamphuis avatar
    15 posts
    Member since:
    May 2008

    Posted 24 Nov 2011 Link to this post

    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?
  4. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 25 Nov 2011 Link to this post

    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
  5. Stefan Kamphuis
    Stefan Kamphuis avatar
    15 posts
    Member since:
    May 2008

    Posted 25 Nov 2011 Link to this post

    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
Back to Top