PRB: Controls Lose Focus When You Enable SmartNavigation and AutoPostBack (314206)



The information in this article applies to:

  • Microsoft ASP.NET (included with the .NET Framework 1.1)
  • Microsoft ASP.NET (included with the .NET Framework) 1.0

This article was previously published under Q314206

SYMPTOMS

When you use the TAB key to move through Web Form controls, when you enable both SmartNavigation and AutoPostBack, the control that receives focus loses focus after the control posts back.

CAUSE

This problem occurs because of how SmartNavigation is implemented to track the current state and active element between round trips to the server.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce the Behavior

  1. Create a new ASP.NET page with the following code:
    <%@ Page SmartNavigation="true" language="c#" AutoEventWireup="false" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
      <HEAD>
        <meta name="GENERATOR" Content="Microsoft Visual Studio 7.0">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name=vs_defaultClientScript content="JavaScript (ECMAScript)">
        <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
      </HEAD>
      <body>
        <form id="Form1" method="post" runat="server">
    		<asp:TextBox AutoPostBack=True id=TextBox1 runat="server" />
    		<asp:TextBox AutoPostBack=True id=TextBox2 runat="server" />
        </form>
      </body>
    </HTML>
    					
  2. Run the page.
  3. Type some text in TextBox1, and then press the TAB key to move to the next control. Notice that the focus is temporarily set on TextBox2, but then the focus is lost and set back to the initial control (TextBox1).

REFERENCES

For information about the latest SmartNavigation updates and related information, visit the following Microsoft Web sites:

ASP.NET Hot Fixes Forum
http://forums.asp.net/

Page.SmartNavigation Property (from the Microsoft .NET Framework Class Library)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassSmartNavigationTopic.asp

For additional information, click the following article number to view the article in the Microsoft Knowledge Base:

318320 Error Message When You Submit .aspx Page with SmartNav Under SSL


Modification Type:MajorLast Reviewed:5/10/2006
Keywords:kbprb kbServerControls kbWebForms KB314206