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:

  1. you can abstract away actual control type versus being tied label in case - if expose control difficult swap out label mynewcoollabel, example
  2. you may exposing more want - client change display properties of label, etc.

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -