PRB: HTML User Control (.ascx File) May Not Work as Expected in Netscape (318101)
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
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
This article was previously published under Q318101 SYMPTOMS
The Hypertext Markup Language (HTML) that Visual Studio .NET generates for user controls on Web forms may fail to interact as expected with JavaScript when you use Netscape to render the control. You may receive the following error message in Netscape:
Element has no content
The problem is not specific to user controls (.ascx files). This problem occurs with any naming container. For example, you may experience the same behavior in a page that uses a Repeater control with a TextBox in the Repeater item.
CAUSE
This problem occurs because Netscape uses the name instead of the ID to identify form input elements in its document object model (DOM) representation. Because ASP.NET uses a colon to name form input elements in user controls on a Web control on a page, you cannot use certain JavaScript access syntaxes that retrieve data from form fields through the DOM.
RESOLUTION
To resolve this problem, edit the script to use the following syntax:
document.formName["UserControlID:TextBox1"].value
After you change the script to use this syntax, the script works as expected on both Microsoft Internet Explorer and Netscape.
Modification Type: | Minor | Last Reviewed: | 5/23/2005 |
---|
Keywords: | kbprb KB318101 |
---|
|