title: Conditional Statements on Cshtml page with Razor
body: <p>I can't seem to get this code to work. How do I get the <code>TextBoxFor</code> to show on the screen? Nothing I try works.</p>
  
  <pre><code>@foreach (var items in Model.Pages[0].Items){
  &lt;div class="form-group"&gt;
  &lt;label for="pageType" class="col-sm-2 control-label"&gt;Label:&lt;/label&gt;
  
  &lt;div class="col-sm-10"&gt;
      @{
         string htmlOutput;
         if (items.PageItemTypeId == (int)HOD.Controllers.PageItemTypesEnum.MainTextContent)
         {
             htmlOutput = @Html.TextBoxFor(x =&gt; items.PageContent, new { @class = "form-control", @placeholder = "Content" }).ToHtmlString();
             Response.Write(htmlOutput);
         }
    &lt;input type="hidden" id="pageTypeId" /&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>