how to I disabled or grayout the edit or save button based on the user priviliges or the roles in mvc4 applications using razor syntax. user will see the button and not able to click or selecting the button in MVC4. how to check the validations in MVC4 Razor ?
Asked
Active
Viewed 1,190 times
1 Answers
0
you can use the if conditions
@if(yourConditionIsTrue)
{
<input type="submit" disabled="disabled" value="Edit" />
}
or some ternary operators
<button type="submit" @((yourCondition==true) ? "disabled" : "")>EditPage</button>

Ravi Gadag
- 15,735
- 5
- 57
- 83
-
But someone can go to developer tools and edit the html and delete the disabled keyword means it enabling in the client side. so the user will edit the button. i want only secured mechanisms to disabling the button in view side as same as your above syntax – kalimuthu Sep 20 '13 at 13:54