Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 873198 - Last Review: May 18, 2007 - Revision: 2.6
The TextChanged event of a TextBox control may not fire if the AutoComplete feature is enabled in Internet Explorer
When you enable the AutoComplete feature of forms in
Microsoft Internet Explorer and then you select any text from the AutoComplete
drop-down list of a
TextBox control in a Web application, the
TextChanged event of the
TextBox control does not fire even though the text in the
TextBox control changes.
This behavior occurs because Internet Explorer cannot fire
the
TextChanged event of a
TextBox control when you select text from the drop-down list by using the
AutoComplete feature.
To work around this behavior, disable the AutoComplete
feature of the Web form. To do this, follow these steps:
- In Solution Explorer, right-click
WebForm1.aspx, and then click View
Designer.
- Switch to the HTML view of WebForm1.aspx.
- Locate the following code:
<form id="Form1" method="post" runat="server">
- Replace the code that you located in step 3 with the
following code:
<form id="Form1" method="post" runat="server" autocomplete="off">
This
behavior is by design.
Steps to reproduce the behavior
Enable the AutoComplete feature for forms
- Start Internet Explorer.
- On the Tools menu, click Internet
Options. The Internet Options dialog box
appears.
- On the Content tab, click
AutoComplete under Personal information. The
AutoComplete Settings dialog box appears.
- Under Use AutoComplete for, click to
select the Forms check box, and then click
OK.
- In the Internet Options dialog box, click
OK.
Create a Web application that contains a TextBox control
- Start Microsoft Visual Studio .NET.
- On the File menu, point to
New, and then click Project. The New
Project dialog box appears.
- Click Visual C# Projects under
Project Types, click ASP.NET Web Application
under Templates, type
http://localhost/MyTestApp in the
Location box, and then click OK.
- In Solution Explorer, right-click
WebForm1.aspx, and then click View
Designer.
- On the View menu, click
Toolbox.
- Add a TextBox control to the Web form. By
default, a TextBox control that is named TextBox1 is created.
- In the Properties window of the TextBox1 TextBox control, set the AutoPostBack property to
True.
- In the Properties window of the TextBox1 TextBox control, click Events, and then
double-click TextChanged. The
TextBox1_TextChanged procedure is added in the Code view of
the WebForm1.aspx file.
- Insert a breakpoint at the
TextBox1_TextChanged procedure.
- On the File menu, click Save
All to save all the files.
Build and then debug the Web application
- On the Build menu, click Build
Solution.
- On the Debug menu, click
Start. The WebForm1 - Microsoft Internet
Explorer Web page appears.
- In the text box, type text1, and
then press ENTER. You notice that the debugger stops at the
TextBox1_TextChanged procedure in the Code view of the
WebForm1.aspx file.
- On the Debug menu, click
Continue.
- In the text box on the WebForm1 - Microsoft
Internet Explorer Web page, type text2, and
then press ENTER. You notice that the debugger stops again at the
TextBox1_TextChanged procedure in the code view of the
WebForm1.aspx file.
- On the Debug menu, click
Continue.
- In the text box on the WebForm1 - Microsoft
Internet Explorer Web page, type t. You notice
a drop-down list of words that you typed earlier.
- Use the DOWN ARROW key to select text1,
and then press ENTER.
You see that the TextChanged event of the TextBox1 TextBox control does not fire.
For more information, visit the following Microsoft
Developer Network (MSDN) Web sites:
APPLIES TO
- Microsoft ASP.NET 1.1
- Microsoft ASP.NET 1.0
| kbprb kbcontrol kbproperties kbwebforms kbtshoot KB873198 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate