I want to have a secure control but also want to extend the existing button or textbox the asp.net framework provides. So my class dec would look something like:
public class MyTextBox : System.Web.UI.WebControls.TextBox
I was thinking something like a strategy pattern for doing it, but not sure how I could pass in a ISecureControl into the ctor or maybe an init method or something?
I might be answering my own question. I guess I might be able to override a OnInit or OnPreInit or something and create and pass it there, but wasn't sure if there's a way to just directly pass it in somehow at creation?
override OnInit()
{
secureControl = new MySecureControl();
}
override OnRender()
{
if(secureControl.CanRender)
base.OnRender();
}
Is there a better way? or am I solving my own problem here...