Using Control Adapters

Control templates are useful, but they are not supported by all controls, and they allow us to change only certain aspects of a control's appearance. An alternative approach is to use a control adapter.

Creating a Control Adapter

A control adapter is a mechanism designed to deal with differences between browsers, but we can co-opt it to gain wider influence over a control. To demonstrate creating and using a control adapter, we will use the RadioButtonList control. Listing 16-12 shows some markup that uses this control in a page.

Listing 16-12. Using the RadioButtonList control

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApp.Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML ...

Get Applied ASP.NET 4 in Context now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.