Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Add following script in js file called i.e focus.js:</p> <pre><code>var lastFocusedControlId = ""; function focusHandler(e) { document.activeElement = e.originalTarget; } function appInit() { if (typeof(window.addEventListener) !== "undefined") { window.addEventListener("focus", focusHandler, true); } Sys.WebForms.PageRequestManager.getInstance().add_pageLoading(pageLoadingHandler); Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoadedHandler); } function pageLoadingHandler(sender, args) { lastFocusedControlId = typeof(document.activeElement) === "undefined" ? "" : document.activeElement.id; } function focusControl(targetControl) { if (Sys.Browser.agent === Sys.Browser.InternetExplorer) { var focusTarget = targetControl; if (focusTarget &amp;&amp; (typeof(focusTarget.contentEditable) !== "undefined")) { oldContentEditableSetting = focusTarget.contentEditable; focusTarget.contentEditable = false; } else { focusTarget = null; } targetControl.focus(); if (focusTarget) { focusTarget.contentEditable = oldContentEditableSetting; } } else { targetControl.focus(); } } function pageLoadedHandler(sender, args) { if (typeof(lastFocusedControlId) !== "undefined" &amp;&amp; lastFocusedControlId != "") { var newFocused = $get(lastFocusedControlId); if (newFocused) { focusControl(newFocused); } } } Sys.Application.add_init(appInit); </code></pre> <p>Reference it using Scriptmanager like below:</p> <pre><code>&lt;ajax:ScriptManager ID="ScriptManager1" runat="server"&gt; &lt;Scripts&gt; &lt;ajax:ScriptReference Path="~/Js/FixFocus.js" /&gt; &lt;/Scripts&gt; &lt;/ajax:ScriptManager&gt; </code></pre> <p>For more information check out below link:</p> <p><a href="http://couldbedone.blogspot.in/2007/08/restoring-lost-focus-in-update-panel.html" rel="nofollow">http://couldbedone.blogspot.in/2007/08/restoring-lost-focus-in-update-panel.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload