在ASP.NET Web窗体prevent自动关闭html标签 [英] Prevent self closing html tags in ASP.NET Web Forms
问题描述
我学习ASP.NET Web Forms和我想知道如果生成的HTML code时,它可能prevent自动关闭标签。例如,如果我创建一个输入元件,它将自关闭我怎样才能prevent呢?
I'm learning ASP.NET Web Forms and I'm wondering if it's possible to prevent self closing tags when the html code is generated. For instance, if I create an input element, it will self close. How can I prevent this?
下面是code我指的是:
Here is the code I'm referring to:
<asp:TextBox id="txt1" runat="server"></asp:TextBox>
感谢您!
编辑:最近我安装了Visual Studio 2013 Ultimate和这是我发现的:
I recently installed Visual Studio 2013 Ultimate and this is what I found:
- 工具>选项>文本编辑器> HTML>高级> XHTML代码风格
- 从变化的真正的到的假的
- Tools > Options > Text Editor > HTML > Advanced > XHTML coding style
- change from True to False
和则:
- 工具>选项>文本编辑器> HTML(Web窗体)>格式>标记特定选项>默认设置>客户端标记不支持内容>关闭标签
- 从的自动关闭标签的变化的没有结束标签的
- Tools > Options > Text Editor > HTML (Web Forms) > Formatting > Tag Specific Options > Default Settings > Client tag does not support contents > Closing tag
- change from Self-closing tag to No closing tag
然而,
&LT; ASP:文本框=服务器&GT;&LT; / ASP:文本框&GT;
仍然给我&LT;输入类型=TEXT/&GT;
在编译HTML5 code。我要的结果是&LT;输入类型=文本方式&gt;
However,
<asp:TextBox runat="server"></asp:TextBox>
still gives me<input type="text" />
in the compiled HTML5 code. The result I want is<input type="text">
.所以,如果有人知道如何做到这,我就AP preciate它。谢谢!
So if anyone knows how to accomplish this, I would appreciate it. Thanks!
推荐答案
按照<一href=\"http://stackoverflow.com/questions/5110446/disable-visual-studio-2010-html-tag-pair-editing\">this链接。当然,要你需要的是
Follow this link. Surely want you need is to
- 工具
- 选项
- 文本编辑器
- HTML
- 格式
- 取消勾选自动插入结束标记
- Tools
- Options
- Text Editor
- HTML
- Formatting
- Uncheck the box for Auto insert close tag
这篇关于在ASP.NET Web窗体prevent自动关闭html标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!