title: Conditional Html attribute using razor
body: <p>I have a situation where I want to display a button as being enabled or disabled depending on a property which has been set on the view model.</p>
  
  <pre><code>@if (Model.CanBeDeleted)
  {
      &lt;button type="button" class="btn btn-danger btn-sm"&gt;
          &lt;span class="glyphicon glyphicon-trash"&gt; &lt;/span&gt;
          Delete
      &lt;/button&gt;
  }
  @if (!Model.CanBeDeleted)
  {
      &lt;button disabled="disabled" type="button" class="btn btn-danger btn-sm"&gt;
          &lt;span class="glyphicon glyphicon-trash"&gt; &lt;/span&gt;
          Delete
      &lt;/button&gt;
  }
  </code></pre>
  
  <p>The code currently in my view, which can be seen above, does work.</p>
  
  <p>However, I am looking for a way that I can wrap only the <code>disabled</code> attribute in the if statement rather than having a separate button element for each case.</p>
  
  <p>Any suggestions for how I can do this?</p>