简体   繁体   中英

Modify ASP.NET TextBox generated html?

Is it possible to modify the html generated by ASP.NET so that it automatically closes the input tag for a <asp:TextBox> currently it is generating the follow html code:

<input name="ctl00$txtTest" type="text" value="xxx" id="txtTest_0">

is it possible for it to generate the same but with a self closure tag as follows (note the forward slash at the end):

<input name="ctl00$txtTest" type="text" value="xxx" id="txtTest_0" />

Is the something i could do to perhaps force a specific DocType rendering or similar?

This should work

Tools > Options > Text Editor > HTML > Advanced > XHTML coding style change to False And then:

Tools > Options > Text Editor > HTML (Web Forms) > Formatting > Tag Specific Options > Default Settings > Client tag does not support contents > Closing tag change to No closing tag

after that debug again and check the generated source

如果您使用Visual Studio,请按以下步骤操作工具--->选项--->文本编辑器---> HTML ---->格式设置--->删除自动插入关闭标记

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM