Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 316946 - Last Review: August 29, 2005 - Revision: 3.1
Visual Studio .NET editor malforms HTML tags
This article was previously published under Q316946
On This Page
SYMPTOMS
In Microsoft Visual Studio .NET, you may receive a parser error under the following
circumstances:
- You use a Hypertext Markup Language (HTML)
element.
- You do not include a space between the end tag (/>) and
the value of the last attribute that is located inside a <FORM> tag on a
Web form in Microsoft Visual Studio .NET.
- You open the page in your browser.
Under these circumstances, you may receive the following parser
error:
Unexpected end of file looking for <FORM>
tag.
This problem occurs with other HTML elements such as <A>,
<LABEL>, < B >, <TEXTAREA>, and others. However, this issue
was resolved for certain tags such as the <DIV> and <SPAN> tags
starting with Microsoft Visual Studio .NET 2003.
CAUSE
When you switch between design view and HTML view, the
Visual Studio .NET editor changes the code in your Web form, which malforms the
tags. This problem only occurs when you do not include a space between the end
tag (/>) and the value of last attribute of the tag.
RESOLUTION
To work around this problem, modify the tag as follows:
<FORM id="myform" method="post" runat="server">
<SPAN id="MySpan" runat="server"></SPAN>
</FORM>
- or -
<FORM id="myform" method="post" runat="server">
<SPAN id="MySpan" runat="server" />
</FORM>
Notice that the second code sample includes a space before the end tag
(/>).
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.
MORE INFORMATION
Steps to reproduce the behavior
- Create a new Visual Studio .NET Web Application
project.
- Add a new Web form, and then open the form in HTML
view.
- Add the following code in HTML view:
<FORM id="myform" method="post" runat="server">
<SPAN id="MySpan" runat="server"/>
</FORM>
- Switch between design view and HTML view repeatedly. Notice
that the code eventually changes to:
<FORM id="myform" method="post" runat="server">
<SPAN id="MySpan" runat="server">
</FORM>
</SPAN>
- Save and browse to the page.
APPLIES TO
- Microsoft Visual Studio .NET 2002 Professional Edition
- Microsoft Visual Studio .NET 2002 Enterprise Architect
- Microsoft Visual Studio .NET 2002 Enterprise Developer
- Microsoft Visual Studio .NET 2002 Academic Edition
- Microsoft Visual Studio .NET 2003 Professional Edition
- Microsoft Visual Studio .NET 2003 Enterprise Architect
- Microsoft Visual Studio .NET 2003 Enterprise Developer
- Microsoft Visual Studio .NET 2003 Academic Edition
- Microsoft ASP.NET (included with the .NET Framework)
| kbvs2002sp1sweep kbbug kbdesigner kbgrpdsasp kbhtml kbideproject kbpending kbwebforms KB316946 |
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
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please