Category Archives: javascript

Could not set focus on the invisible object – AjaxControlToolkit

Recently when we updated our AjaxControlToolkit library, strangely it was giving an “Could not set focus on the invisible Object” error on some machines. When I debugged it, the error raised with the tab panel. The same code is working fine with the older AjaxControlToolkit library version. But we modified our pages to suit the latest version so we had to tweek the current version js function. The developers of AjaxControlToolkit have added a method to set focus on the tab panels. The following code resolved the issue..

        //To resolve an error(set focus) with the current AjaxControlToolkit version (4.1.51116.0)
        if (Sys.Extended.UI.TabPanel != 'undefined' && Sys.Extended.UI.TabPanel) {
            Sys.Extended.UI.TabPanel.prototype._setFocus = function (a) {
                var x = $get("__tab_" + a.get_element().id);
                if (x.hidden == false && != 'hidden' && != 'none')