Re: role based security to enable controls

From: richlm (richlm_at_nospam.nospam)
Date: 02/25/05


Date: Fri, 25 Feb 2005 23:46:18 +0100

One approach is to perform a role-based security check in the
"VisibleChanged" event (or override "OnVisibleChanged" if appropriate).
You can then set the Enabled property appropriately.
In your Form_Load event you could iterate the Controls on the form and
attach the event handler.

You can assign roles to controls declaratively in code with a custom
attribute, and then use reflection in the event handler code to get the
attribute.



Relevant Pages

  • Re: Overriding "OnXXX" versus adding event handler
    ... to touch base functionality and not to deal with component ... Either for base class or for my class. ... For example, you can either write a new OnPaint override, or you can ... In other words, override when you can, add an event handler if you can't. ...
    (microsoft.public.dotnet.framework)
  • Re: translate VB -> CS
    ... To follow the event handler practise, ... Wire the event handler ... Bit simpler way is to just override Page's OnPreRender method when all the ... but it is then important to remember to call the base class method ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Web Form Designer generated code
    ... The first section is an override of the Page.OnInit method. ... IDE calls the event handler method Page_Load. ... > override protected void OnInit{ ... > InitializeComponent(); ...
    (microsoft.public.dotnet.languages.csharp)
  • Overriding "OnXXX" versus adding event handler
    ... How does one decide whether to write an "override" method to an event and when to simply add an event handler for that event? ... For example, you can either write a new OnPaint override, or you can register a delegate that the Control's base OnPaint method will execute. ... My current thought is that when you are not inheriting from the base class, you register a delegate, and when you are inheriting from the base class, you override the method. ...
    (microsoft.public.dotnet.framework)
  • Re: event vs method override
    ... To override you need to be a derived class whereas anyone can add an event handler to a control. ... I have to implement added functionality in a child class, ...
    (microsoft.public.dotnet.languages.csharp)