http://pabloblamirez.blogspot.com - When you ask a question, remember to click "mark as answered" when you get a reply which answers your question; this ensures the right forum member gets credit below for being helpful (and makes search more relevant too).
erossetto
Member
255 Points
52 Posts
Prevent <% expression %> from adding extra blank line
Nov 22, 2008 07:44 PM|LINK
Hello there,
Consider the following:
<ul> <% foreach (blah) { %> <li><%= Html.ActionLink(...) %></li> <% }> </ul>Output:
(Note the extra blank lines)
I really hate this behavior... I would really like to have clean HTML
html
PaulBlamire
Participant
1272 Points
227 Posts
Re: Prevent <% expression %> from adding extra blank line
Nov 22, 2008 10:41 PM|LINK
would removing the newline between your foreach and your content help?
<% foreach (blah) { %><li><%= Html.ActionLink(...) %></li> <% }>Paul Linton
Star
13581 Points
2571 Posts
Re: Prevent <% expression %> from adding extra blank line
Nov 22, 2008 11:20 PM|LINK
I reposition the <% to be immediately after the preceeding html tag, like this
<ul><%
foreach(...) { %>
<li>blah</li><%
} %>
</ul>