title: Interrupting calling data-url-action in Razor View from javascript
body: <p>In application we are handling button actions by putting action name and controller name in data-url-action attribute in Razor Views like below:</p>
  
  <pre><code>&lt;button type="button" class="btn" title="Add" data-url-action="@Url.Action("Add", "Home")"&gt;
      &lt;span class="glyphicon glyphicon-plus" aria-hidden="true"&gt;&lt;/span&gt;
  &lt;/button&gt;
  </code></pre>
  
  <p>And it works perfectly, but now I want to allow or not allow calling that action from controller. In my javascript I have function:</p>
  
  <pre><code>function setButtonsAccessibility(control) {
      if (!checkControl(control) {
          control.onclick = (function (event) {
              debugger;
              event.preventDefault();
          });
      }
  }
  </code></pre>
  
  <p>That function catch onClick event before action from controller is called, but I have no idea how to interrupt it. That onclick function is attached when my requirements are fullfiled and here I want to prevent firing action.</p>
  
  <p>I was considering to override some Razor function which recognize clicking on button with completed data-url-action as equal redirecting to pointed action, but I have no information how to find that function. Is there any possibility to solve that issue in this way or maybe is simpler solution?</p>
  
  <pre><code>event.preventDefault();
  </code></pre>
  
  <p>Calling mentioned above function does not solve problem.</p>
  
  <p>I'm looking for generic solution, I'm not able to make hundreds changes in views - that's why I want to solve it by script.</p>