title: Seemingly simple MVC partial view question
body: <p>I am trying to display my data (images) in two columns of a table in my partial view. The code below does not seem to work as it displays each image in its own row. What am I missing?</p>
  
  <pre><code>&lt;%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %&gt;
  &lt;%@ Import Namespace="ULS_Site.Models"%&gt;
  
  &lt;%var alternating = false;%&gt;
  &lt;table&gt;
  &lt;% foreach (var item in ViewData.Model as IEnumerable&lt;image&gt;) %&gt;
  &lt;%{%&gt;
  &lt;%if (!alternating) %&gt;
  &lt;%{ %&gt;
  &lt;tr&gt;
  &lt;%}; %&gt;
  
  &lt;td&gt;
      &lt;a href="&lt;%= item.image_path %&gt;" target="_blank" &gt;
      &lt;img src="&lt;%= item.image_path %&gt;" alt=" "  width="100"  /&gt;
      &lt;/a&gt;
  &lt;/td&gt;
  &lt;%if (!alternating) %&gt;
  &lt;%{ %&gt;
  &lt;/tr&gt;
  &lt;%}; %&gt;
  &lt;%alternating = !alternating;%&gt;
  &lt;%}%&gt;
  &lt;/table&gt;
  </code></pre>