T
Terry Holland
Ive started a new thread as original seems to have dried up. I was replying
to Steven Cheng.
Steven
Im getting in a bit of a mess with this. What I want to end up with is a
set of controls for editing / displaying fields on a webform. I would like
to be able to dynamically add these controls to webforms as and when I need
them.
Initially I need three types of fields
ctlFieldReadOnly
ctlFieldEditable
ctlFieldEditableRequired
Each of these controls will consist of the following controls:
ctlFieldReadOnly: Label (lblLabel) and a label (lblValue) to display the
data
ctlFieldEditable: Label (lblLabel) and a textbox (txtValue - background
colour blue) to the display the data
ctlFieldEditableRequired: Label (lblLabel) and a textbox (txtValue -
background colour yellow) to the display the data.
Each of these controls needs to expose a Label property and a Value
property.
Each control should be able to be configured so the either, the Label
control is above the Value control, or the Label control appears to the Left
of the Value control.
Each form may contain any number of each type of control.
Ive been trying to develop along the following lines:
Create a Base control such as ctlField that must be inherited. This control
will contain the properties Label, Value, Width and HorizontalAlignment.
Im then trying to derive the required controls from this control. My derived
controls should add the relevant webcontrols ie Label to display the Value
for a ctlReadOnly control, a Textbox to display the Value for
ctlFieldEditable & ctlFieldEditableRequired controls.
Im getting various results ranging from no controls being displayed, not
being able to refer to controls in order to read/write values.
It would be very helpful if you could provide a small sample of how I might
get this sort of scenario to work (VB if possible - I know you prefer C#)
Terry
to Steven Cheng.
Steven
Im getting in a bit of a mess with this. What I want to end up with is a
set of controls for editing / displaying fields on a webform. I would like
to be able to dynamically add these controls to webforms as and when I need
them.
Initially I need three types of fields
ctlFieldReadOnly
ctlFieldEditable
ctlFieldEditableRequired
Each of these controls will consist of the following controls:
ctlFieldReadOnly: Label (lblLabel) and a label (lblValue) to display the
data
ctlFieldEditable: Label (lblLabel) and a textbox (txtValue - background
colour blue) to the display the data
ctlFieldEditableRequired: Label (lblLabel) and a textbox (txtValue -
background colour yellow) to the display the data.
Each of these controls needs to expose a Label property and a Value
property.
Each control should be able to be configured so the either, the Label
control is above the Value control, or the Label control appears to the Left
of the Value control.
Each form may contain any number of each type of control.
Ive been trying to develop along the following lines:
Create a Base control such as ctlField that must be inherited. This control
will contain the properties Label, Value, Width and HorizontalAlignment.
Im then trying to derive the required controls from this control. My derived
controls should add the relevant webcontrols ie Label to display the Value
for a ctlReadOnly control, a Textbox to display the Value for
ctlFieldEditable & ctlFieldEditableRequired controls.
Im getting various results ranging from no controls being displayed, not
being able to refer to controls in order to read/write values.
It would be very helpful if you could provide a small sample of how I might
get this sort of scenario to work (VB if possible - I know you prefer C#)
Terry