how to enable and disable button based on user role?

前端 未结 6 1878
予麋鹿
予麋鹿 2021-01-13 20:22

I have a role called \'member\' and another \'admin\' in Asp.Net website.

I did before, that button should be visible or not and i am successful in that,but,i am not

6条回答
  •  [愿得一人]
    2021-01-13 21:25

    In the Page_Load after checking for the role you may be able to set the IsEnabled for the Button to be False.

    e.g. buttonLogin.Enabled = (IsUserInRole(Admin));

提交回复
热议问题