title: Disable a button using razor pages
body: <p>I have a form build via <code>Razor Pages</code>. The form consists of two submit buttons - each of them is assigned to an appropriate <code>asp-page-handler</code>, like this: </p>
  
  <pre><code>@page "{id:int}"
  //...
  &lt;form asp-action="Post"&gt;
      &lt;input type="submit" asp-page-handler="Approve" class="btn btn-success" value="Approve" /&gt;
      &lt;input type="submit" asp-page-handler="Decline" class="btn btn-danger" value="Decline" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Handlers works correctly. Now I need to disable the Approve button by some condition. 
  Unfortunately I can't figure out what is the right way to archieve this using <code>Razor Pages</code>?</p>
  
  <p>I tried the following (condition is simplified):</p>
  
  <pre><code>@{ var disableTag = "disabled"; } 
  ...
  &lt;input type="submit" asp-page-handler="Approve" class="btn btn-success" value="Approve"  @disableTag /&gt;
  </code></pre>
  
  <p>After launch of the app markup remained unchanged and the button is still enabled. Seems like <code>asp-page-handler</code> tag forces the razor engine to ignore <code>@disableTag</code> variable.</p>
  
  <p>Next attempt was (<code>@disableTag</code> was put in front of <code>asp-page-handler</code>): </p>
  
  <pre><code>&lt;input type="submit" @disableTag asp-page-handler="Approve" class="btn btn-success" value="Approve" /
  </code></pre>
  
  <p>Now the page rendered correctly (<code>disabled</code> tag is there), but the handler itself stopped working (the markup shows <code>asp-page-handler="Approve"</code> as a plain tag instead of something like <code>/{PageName}/{id}?handler=Approve</code>)</p>
  
  <p>What am I doing wrong here?</p>