Y
Yuri Vanzine
I have a Custom Control that I inherit from a User Control like this:
public class SecureUserControl : UserControl, INamingContainer
it maintains a few control states like visible, readonly relying on security settings.
I override CreateChildControls() similar to how you woud handle a custom web control.
Every User Control I design inherits from SecureUserControl and not from System.Web.UI.UserControl.
The problem is that every time a private member is changed in one secureusercontrol-derived control, ie I change _readonly boolean member thru a button, the value in all the other secureusercontrol-derived controls changes also (I have 3 secureusercontrol-derived controls on the page and they end up sharing(???) the readonly property).
In classic OOP, whatever happens to the object does not affect other objects, unless you are using a singleton class.
My question to you, is UserControl class special or am I 'special' and do not understand how to apply oop to asp.net?
Please help!
P.S. I need to inherit from a UserControl and not from a WebControl or Control. The idea is to make your UserControls security-aware in one class and inherit from it.
public class SecureUserControl : UserControl, INamingContainer
it maintains a few control states like visible, readonly relying on security settings.
I override CreateChildControls() similar to how you woud handle a custom web control.
Every User Control I design inherits from SecureUserControl and not from System.Web.UI.UserControl.
The problem is that every time a private member is changed in one secureusercontrol-derived control, ie I change _readonly boolean member thru a button, the value in all the other secureusercontrol-derived controls changes also (I have 3 secureusercontrol-derived controls on the page and they end up sharing(???) the readonly property).
In classic OOP, whatever happens to the object does not affect other objects, unless you are using a singleton class.
My question to you, is UserControl class special or am I 'special' and do not understand how to apply oop to asp.net?
Please help!
P.S. I need to inherit from a UserControl and not from a WebControl or Control. The idea is to make your UserControls security-aware in one class and inherit from it.