KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When typing code in a .aspx file (an MVC view in this case), Visual Studio applies two types of formatting, one to the regular html tag structure (which can be controlled from Tools->Options->Text Editors->Html) and another to content inside the <% %> tags. I've run into two annoyances with the second type of automatic formatting, the <% %> content formatting. First is how new lines are added to statement blocks: If I type this: <% if(condition) { %> ... <% } %> It is autocorrected to this: <% if(condition) { %> ... <% } %> While the correction is right if this was a .cs file, for the tag soup that is .aspx files I find the first far more readable. Is there a way to turn off this behavoir without affecting the formatting of .cs files? Second, whenever I write something like this: <%=Html.ActionLink("Report","ListItems") %> I can't find a way to make it automatically format into this (add spacing where appropriate): <%=Html.ActionLink("Report", "ListItems") %> In code you normally need a ; or } to signal that you are done a line/section of code so that Visual Studio can format it. Is there a way to give this signal for a <%= type of expression? CLARIFICATION This question is about the formatting of code inside <% %> tags without affecting the formatting of regular C# source files . It says right in the first paragraph that I am completely aware of the Text Editors menu.
Tags (comma-separated)
Save Edits
Cancel