asp.net - Inherit properties into custom control C# -
i have custom control have created bunch standard windows asp controls on it.
question:
is possible inherit properties of parent control custom control without re-inventing wheel?
so example have control button, textbox, , label.
normally can access properties of control via lable1.text
when these controls places within custom control how access them without encapsulating properties of control individually.
i hoping customcontrol1.lable1.text
or not possible
if use public label lbmoviename { { return this.lbmovename; } set { lbmoviename = value; } }
i need can please tell me why should not it?
the easiest way expose control through public read-only property:
public label mylabel { { return this.label1; } }
however encapsulating values want expose cleaner solution several reasons:
- you can abstract away actual control type versus being tied
label
in case - if expose control difficult swap out labelmynewcoollabel
, example - you may exposing more want - client change display properties of label, etc.
Comments
Post a Comment