"Pro ASP.NET 3.5 Server Controls and AJAX Components"
aspx page, just before the footer:
The user can set the following properties: Font-Name, ForeColor, Bold, Italic, and Underline, along with CssClass. In ASP.NET 1.1, the .aspx page had a link to an external style sheet called WebControlStyle. This was useful for exercising the CssClass property, as all the style rules had class selectors:
140 CHAPTER 4 ?– T HE WEBCONTROL BASE CLASS AND CONTROL S TYLES Figure 4-8. The Web Control Style web form In ASP.NET 2.0 and later, when using master pages, a tag can be added directly to the portion of the .aspx page, by adding a content tag to the head section of the master page. Another option is to add the tag programmatically as shown here: private void AddCssLinktoHeader() { HtmlLink cssRef = new HtmlLink(); cssRef.Href = "../Ch04/WebControlStyle.css"; cssRef.Attributes.Add("rel", "stylesheet"); cssRef.Attributes.Add("type", "text/css"); Header.Controls.Add(cssRef); } Notice that the Href value must be provided relative to the directory where the master page exists. To try applying a CSS class selector via the CssClass property, type either yellowbackground or grayborder in the CSS class text box, and click the Set Style button.