Prev | Current Page 229 | Next

Rob Cameron and Dale Michalk

"Pro ASP.NET 3.5 Server Controls and AJAX Components"

Setting the font to have an underline style
using this method is the reason why the text-decoration property does not affect the display
in HTML 3.2 and why you should be careful when using the Style property unless you are only
targeting an up-level browser. The class attribute is present as well, but it is ignored by the
down-level browser, so we won??™t see a border either. As you can see, building controls that
inherit from WebControl provides cross-browser support without your having to worry about
the details of browser detection and raw HTML output. We next discuss what goes on under
the covers with respect to down-level browser support.
CHAPTER 4 ?–  THE WEBCONTROL BASE C LASS AND CONTROL STYLES 149
Down-Level Browser Style Rendering Behind the Scenes
The style conversion that occurs automatically when the Web Control Style web form is viewed
in the down-level Netscape browser is a clever technology built into the ASP.NET framework.
When a request is made for an .aspx page, ASP.NET parses the header information to determine
the capability of the browser. An instance of the System.Web.HttpBrowserCapabilities class is
attached to the HttpRequest class via its Browser property.
The HttpBrowserCapabilities class has a TagWriter property pointing to an instance of the
HtmlTextWriter class, or a type inherited from it, to inject HTML into the output stream.


Pages:
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241