Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Lots of things. You could just delete the whitespace... multiple whitespaces aren't significant in either C# or HTML.</p> <p>Or you could rewrite your view to use a view model DTO closely coupled to the structure of the page, so you're emitting pre-formatted fragments and rendering partial controls instead of having any complex control logic in your page code?</p> <p>If you want to post your source, I'm sure there's ways to eliminate the whitespace if you <em>really</em> want to. But you're probably better off just ignoring it. :)</p> <p>EDIT: OK, try this. Use a dedicated view model, so you can have your controller assign things like Image URLs in the controller logic instead of branching in the page code. </p> <pre><code>&lt;img src="/Content/Images/filterMainCuisineHeader.gif" /&gt; &lt;ul&gt; &lt;% int count = 1; foreach (var filter in Model.Filter) { if (filter.GroupOrder != count) { count++; %&gt;&lt;/ul&gt; &lt;img src="&lt;%=filter.ImageUrl%&gt;" width="175" height="30" /&gt; &lt;ul&gt; &lt;% } if (filter.TagCount &gt; 0) { %&gt; &lt;li class="&lt;%=filter.CssClass%&gt;"&gt; &lt;%: filter.TagLabel %&gt; (&lt;%: filter.TagCount %&gt;) &lt;span class="closeImage"&gt; &lt;img src="/Content/Images/filterButtonClose.gif" /&gt;&lt;/span&gt; &lt;/li&gt;&lt;% } } %&gt;&lt;/ul&gt; &lt;/div&gt;&lt;!-- END Content --&gt; </code></pre> <p>You'll need Model.Filter to be an IEnumerable, which looks like:</p> <pre><code>public class FilterViewData { public int GroupOrder { get; set; } public int TagCount { get; set; } public string CssClass { get; set; } public string ImageUrl { get; set; } public string TagLabel { get; set; } } </code></pre> <ul> <li>something like <a href="http://automapper.codeplex.com/" rel="nofollow">AutoMapper</a> might prove very useful in populating your view data objects.</li> </ul> <p>In this example, you'd also create a CSS rule like:</p> <pre><code>li.unchecked span.closeImage { display: none; } </code></pre> <p>so that the closeImage span and image don't appear inside the unchecked list items.</p> <p>Does that help?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload