Add(table);
}
}
}
24 CHAPTER 1 ?– SERVER CONTROL BASICS
Comparing this simple controls demonstration to the HTML controls demonstration
shows little difference beyond changes to control names and namespaces. One minor difference
is the fact that in the simple controls demonstration, a PlaceHolder control (yes, there really is
a PlaceHolder class) acts as the container for holding the cell content. The PlaceHolder control
does not have a UI; instead, it renders only the UI of its child controls. This is in contrast to the
HTML controls demonstration, which used HtmlGenericControl representing a
tag for
holding the cell content.
The bigger difference between the two examples is the Cascading Style Sheet (CSS) style
configuration. In the HTML controls demonstration, we had to use a more explicit syntax without
the benefit of help from the control object model or IntelliSense in Visual Studio. However, in
this simple controls demonstration, we have full access to the assistance provided by the Framework
and Visual Studio. The following code snippet shows how easy it is to set color and other
font styling in with simple controls:
cell = new TableCell();
cell.BackColor = Color.Blue;
cell.BorderWidth = 1;
cell.
Pages:
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76