CssClass is a string property that translates directly to rendering a class attribute on the
control tag. Setting the CssClass property in the .aspx page for the ASP.NET Label WebControl
Table 4-1. Properties of the System.Web.UI.WebControls.Style Class
Style Property CSS Property
BackColor background-color
BorderColor border-color
BorderStyle border-style
BorderWidth border-width
CssClass CSS class name
Font Font weight, style, family, and so on
ForeColor color
Height height
Width width
132 CHAPTER 4 ?– T HE WEBCONTROL BASE CLASS AND CONTROL S TYLES
translates into the following HTML:
blankThe Font property exposes a set of subproperties, so we continue our property examination
with Table 4-2 for the System.Web.UI.FontInfo class.
WebControl Top-Level Style Properties
Going through the ControlStyle property to access these attributes would require a lot of extra
typing when setting style properties in either the .aspx control tag or the code-behind class file.
The WebControl class makes life easier by exposing all of the properties listed in Tables 4-1 and
4-2 directly as properties (see Figure 4-6), which saves a lot of typing.
Pages:
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223