Disabling Actionlink CLICK event

Asked

Viewed 56 times

2

I have the following link in my view :

@Html.ActionLink(" ", "Editar", new { id = item.ID }, new { @id = "btnEditar" })

And when loading the page, I have to block this link, according to the user’s profile. I’m trying to disable the link click this way :

$('#btnEditar').prop('disabled', true);
$('#btnEditar').css('cursor', 'not-allowed');

However, by clicking the button, the event is being triggered, which I don’t want. What should I do ?

1 answer

2


Solved. I did it this way:

$('#btnEditar').css('cursor', 'not-allowed');
$('#btnEditar').click(function () { return false; });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.