protected virtual ControlAdapter ResolveAdapter ()
{
HttpContext context = Context;
if (context == null)
return null;
if (!context.Request.BrowserMightHaveAdapters)
return null;
// Search up the type hierarchy until we find a control with an adapter.
IDictionary typeMap = context.Request.Browser.Adapters;
Type controlType = GetType ();
Type adapterType = (Type)typeMap [controlType];
while (adapterType == null && controlType != typeof (Control)) {
controlType = controlType.BaseType;
adapterType = (Type)typeMap [controlType];
}
ControlAdapter a = null;
if (adapterType != null)
a = (ControlAdapter)Activator.CreateInstance (adapterType);
return a;
}