Home Interrupting calling data-url-action in Razor View from javascript

# Interrupting calling data-url-action in Razor View from javascript

Bartosz
1#
Bartosz Published in 2017-09-14 10:45:30Z
 In application we are handling button actions by putting action name and controller name in data-url-action attribute in Razor Views like below:   And it works perfectly, but now I want to allow or not allow calling that action from controller. In my javascript I have function: function setButtonsAccessibility(control) { if (!checkControl(control) { control.onclick = (function (event) { debugger; event.preventDefault(); }); } }  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. 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? event.preventDefault();  Calling mentioned above function does not solve problem. 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.
Feanaro
2#