I have created three user controls (lets call them A,B, and C), each contains three controls: an add button, a remove button, and a submit button. Each user controls also houses a number of other controls (let's say A has textboxes, B has dropdowns, and
C has radio buttons).
The 'add' button on each control adds a control to the the user control's control list (ie. A.Controls.add(new textbox), B.Controls.add(new dropdown), etc).
The 'remove' button on each control removes a control from the user control's control list.
The 'submit' button returns a list of all values from the controls in the user control's control list.
I want to have these user controls inherit from a base class, but I am running into some trouble. I moved the add, remove, and submit buttons to the base class and removed them from the child classes (A,B, and C). When I try to access the buttons through
the page_load method of a child class, they return null as they don't exist yet for the base class. Am I going about this the wrong way? Any suggestions would help.
caltrop
0 Points
1 Post
Page event cycle for subclassed controls
Feb 25, 2010 08:08 PM|LINK
I have created three user controls (lets call them A,B, and C), each contains three controls: an add button, a remove button, and a submit button. Each user controls also houses a number of other controls (let's say A has textboxes, B has dropdowns, and C has radio buttons).
The 'add' button on each control adds a control to the the user control's control list (ie. A.Controls.add(new textbox), B.Controls.add(new dropdown), etc).
The 'remove' button on each control removes a control from the user control's control list.
The 'submit' button returns a list of all values from the controls in the user control's control list.
I want to have these user controls inherit from a base class, but I am running into some trouble. I moved the add, remove, and submit buttons to the base class and removed them from the child classes (A,B, and C). When I try to access the buttons through the page_load method of a child class, they return null as they don't exist yet for the base class. Am I going about this the wrong way? Any suggestions would help.
inheritance User Control page event cycle base class