When I drag a Label control to my document, I get the following c开发者_StackOverflow中文版ode :
<asp:Label ID="Label1" runat="server" text="Label"></asp:Label>
I prefer my code to look like the following instead :
<asp:Label ID="Label1" runat="server" Text="Label" />
How can I get .NET to do this by default? I looked in Tools -> Options -> Text Editor, where you'd expect to find it, but I couldn't find anything relevant there.
Go back to Tools|Options|Text Editor, and expand the HTML node in the tree. Go to the Format node, and the click the Tag-Specific Options button. In the dialog that opens up, expand the ASP.NET controls tree and find asp:Label. You can set how you want the closing tag in the selector at the top on the right. alt text http://philippursglove.com/stackoverflow/tagspecificclosingoption.png
精彩评论