开发者

ASP.NET MVC View Code Formatting - braces <% } %>

开发者 https://www.devze.com 2022-12-12 06:14 出处:网络
Does anyo开发者_高级运维ne know how to configure visual studio to correctly format code segments within a View

Does anyo开发者_高级运维ne know how to configure visual studio to correctly format code segments within a View

This annoys the crap outta me!:

<select>
<%
foreach(Height height in ViewData.Model.Heights)
{%>
<option value="<%=height.ID %>"><%=height.Value%></option>
<%
}%>
</select>

It should be like this:

<% foreach(Height height in ViewData.Model.Heights) { %>
    <option value="<%=height.ID %>"><%=height.Value%></option>
<% } %>
</select>

I can fix it manually but whenever I reformat, or change some of the code close to the braces it screws up again!


After the auto formatting takes place hit cntrl-z, it will undo the auto-formatting only and not rearrange your code.

0

精彩评论

暂无评论...
验证码 换一张
取 消