Textbox textbox =
(ControlsBook2Lib.Ch04.Textbox)Controls[1];
textbox.ApplyStyle(TextboxStyle);
textbox.MergeStyle(ControlStyle);
}
override protected void Render(HtmlTextWriter writer)
{
PrepareControlHierarchy();
RenderBeginTag(writer);
RenderChildren(writer);
RenderEndTag(writer);
}
}
}
The InputBox Style Web Form
We now put our new server control to the test with an updated version of the styling workbench
from the previous example. The web form example for the InputBox control takes the previous
style setting workbench and adds the ability to set styles for the Label and the TextBox as well.
Figure 4-14 provides a snapshot of the updated workbench with a panel for styling both child
controls.
The control panel for each child control??™s Style has the same feature set as our previous
Web Control Style web form, minus the ability to set the CssClass attribute. It does add a radio
button group at the top of the control boxes that allows you to either set or not set the styling
for the Label or TextBox control. The full code listings for the web form and the code-behind
class file are shown in Listings 4-7 and 4-8, respectively.
CHAPTER 4 ?– THE WEBCONTROL BASE C LASS AND CONTROL STYLES 159
Figure 4-14.
Pages:
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254