title: How do I conditionally show a field in ASP.NET MVC Razor?
body: <p>I am very new to C# and ASP.NET MVC Razor.  I want to show a field in my view if the field is not blank.</p>
  <h3>Code</h3>
  <pre><code>&lt;tr class=&quot;hide&quot; id=&quot;trPhone2&quot;&gt;
              &lt;td class=&quot;editor-label&quot;&gt;
                  @Html.LabelFor(model =&gt; model.phone2)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.EditorFor(model =&gt; model.phone2)
              &lt;/td&gt;
              &lt;td&gt;
                  @Html.ValidationMessageFor(model =&gt; model.phone2)
              &lt;/td&gt;
          &lt;/tr&gt;
  </code></pre>
  <p>Now, I want to output that first <code>&lt;tr&gt;</code> line if the <code>model.phone2 is &quot;&quot;</code> and else output:</p>
  <pre><code>&lt;tr id=&quot;trPhone2&quot;&gt;
  </code></pre>
  <p>How do I do this using ASP.NET MVC Razor?</p>