Reputation: 101
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?
Here is the code I'm referring to:
<asp:TextBox id="txt1" runat="server"></asp:TextBox>
Thank you!
Edit: I recently installed Visual Studio 2013 Ultimate and this is what I found:
And then:
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">
.
So if anyone knows how to accomplish this, I would appreciate it. Thanks!
Upvotes: 2
Views: 1898
Reputation: 1017
If you are using Visual Studio 2015, you can go to :
Tools > Options > Text Editor > HTML > Advanced > XHTML Coding Style - False
Upvotes: 0
Reputation: 389
Follow this link. Surely want you need is to
Upvotes: 1
Reputation: 3047
If you are using Visual Studio 2010, you can go to :
Tools > Options > Text Editor > HTML > Formatting > Tag Specific Options
In here you can change the Default Setting of Client and Server tags to be Seperate
/ Self-Closing
.
You can also change it for specific elements, i.e. <img>
tags by Finding the img
item under Client HTML Tags
Upvotes: 0