开发者

ASP.NET Server Controls Tag for Role Based Authorization

I've got a web form with lots fields and buttons. These fields and buttons should be enabled and disabled based 开发者_开发知识库on users Role i.e. 'employee', 'team leader', 'manager' etc.

Is there a way to tag each fields such as emp for employee, tm for teamleader so that I can enable or disable them with 1 or 2 lines of code?

Otherwise I will have to write lots of if else statement for each controls.

thank you


You can create WebControl[] arrays in the code-behind containing the controls visible to each role:

WebControl[] managerControls = { someControl, otherButton, ... };
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜