title: CSHTML use C# variable in element ID
body: <p>Lets say I have a for-loop to generate elements in a table:</p>
  
  <pre><code>@for (var i = 0; i &lt; Model.Count(); i+=2) {
    &lt;tr&gt;
      @{var a = Model.ElementAt(i); var b = Model.ElementAtOrDefault(i + 1);}
      &lt;td&gt;
        &lt;div id="r@i" class="rack-container"&gt;
          ...              
        &lt;/div&gt;
        &lt;div id="s@i" class="rack-selector fade"&gt;
          ...                   
        &lt;/div&gt;
      &lt;/td&gt;
      &lt;td&gt;
        @if (b != null) {
          &lt;div id="r@i+1" class="rack-container"&gt;
            ...              
          &lt;/div&gt;
          &lt;div id="s@i+1" class="rack-selector fade"&gt;
            ...                   
          &lt;/div&gt;
        }
      &lt;/td&gt;
    &lt;/tr&gt;
  }
  </code></pre>
  
  <p>The problem is that the element is literally assigned "r@i" instead of "r1","r2"..."rN" and so on. Is there any way to combine text and a variable as an element ID?</p>