Ch04.Label label =
(ControlsBook2Lib.Ch04.Label)Controls[0];
return label.Text;
}
set
{
EnsureChildControls();
ControlsBook2Lib.Ch04.Label label =
(ControlsBook2Lib.Ch04.Label)Controls[0];
label.Text = value;
}
}
156 CHAPTER 4 ?– T HE WEBCONTROL BASE CLASS AND CONTROL S TYLES
public string TextboxText
{
get
{
EnsureChildControls();
ControlsBook2Lib.Ch04.Textbox textbox =
(ControlsBook2Lib.Ch04.Textbox)Controls[1];
return textbox.Text;
}
set
{
EnsureChildControls();
ControlsBook2Lib.Ch04.Textbox textbox =
(ControlsBook2Lib.Ch04.Textbox)Controls[1];
textbox.Text = value;
}
}
Style labelStyle;
public virtual Style LabelStyle
{
get
{
if (labelStyle == null)
{
labelStyle = new Style();
if (IsTrackingViewState)
((IStateManager)labelStyle).TrackViewState();
}
return labelStyle;
}
}
Style textboxStyle;
public virtual Style TextboxStyle
{
get
{
if (textboxStyle == null)
{
textboxStyle = new Style();
if (IsTrackingViewState)
((IStateManager)textboxStyle).TrackViewState();
}
CHAPTER 4 ?– THE WEBCONTROL BASE C LASS AND CONTROL STYLES 157
return textboxStyle;
}
}
override protected void LoadViewState(object savedState)
{
if (savedState != null)
{
object[] state = (object[])savedState;
if (state[0] != null)
base.
Pages:
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252