title: Trouble writing HTML in Razor view if/else condition
body: <p>I'm not quite sure what I am missing here, but I am having trouble adding a <code>class='success'</code> to a <code>&lt;tr&gt;</code> in a Partial View while iterating through a list in my Model.</p>
  
  <p>My goal is to have the first row's <code>tr</code> to have the attribute <code>class='success'</code></p>
  
  <p>Here is the code I have: </p>
  
  <pre><code>@model List&lt;DxRow&gt;
  
  &lt;div class="row"&gt;
      &lt;table class="table" id="diagnosis"&gt;
          &lt;tr id="header-row"&gt;
              &lt;th&gt;Dx Code&lt;/th&gt;
              &lt;th&gt;Dx Description&lt;/th&gt;
              &lt;th&gt;Dx Date&lt;/th&gt;
              &lt;th&gt;OnSet Or Ex&lt;/th&gt;
              &lt;th&gt;Dx Order (Top is Primary)&lt;/th&gt;
          &lt;/tr&gt;
  
      @{ bool IsFirst = true; }
      @foreach (DxRow r in Model)
      {
             if (IsFirst)
             { 
                 Html.Raw("&lt;tr class='success'&gt;");
                 IsFirst = false;
             }
             else
             {
                 Html.Raw("&lt;tr&gt;");
             }
         &lt;tr&gt;
  
          &lt;td&gt;@r.dxCode&lt;/td&gt;
          &lt;td&gt;@r.dxDescription&lt;/td&gt;
          &lt;td&gt;@r.dxDate&lt;/td&gt;
          &lt;td&gt;@r.dxType&lt;/td&gt;
          &lt;td&gt;
              &lt;span class='up'&gt;&lt;i class='icon-arrow-up bigger-160' style='color:green'&gt;&lt;/i&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;
              &lt;span class='down'&gt;&lt;i class='icon-arrow-down bigger-160' style='color:red'&gt;&lt;/i&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;
              &lt;span class='top'&gt;&lt;i class='icon-star bigger-160' style='color:goldenrod'&gt;&lt;/i&gt;&lt;/span&gt;&amp;nbsp;&amp;nbsp;
              &lt;span class='delete'&gt;&lt;i class='icon-trash bigger-160' style='color:red'&gt;&lt;/i&gt;&lt;/span&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      }
  &lt;/table&gt;
  </code></pre>
  
  <p></p>
  
  <p>When I step through the code, it goes into the special <code>IsFirst</code> section the first iteration and the <code>else</code> section on all other iterations.</p>
  
  <p>But, when I use FireBug to view the source code, it is not writing the part: <code>&lt;tr class='success'&gt;</code> , just the <code>&lt;tr&gt;</code>.</p>