views:

35

answers:

1

In ASP.Net is there a way to dynamically set a control adapter? The standard way to apply a contol adapter is via the ".browser" files. However, I have a situation where I would like to use the control adapter in some circumstances, but not in others - and i can not find a way to achieve this.

Any help appreciated.

A: 

The code you want is:

Type controlType = typeof(HtmlForm);
Type adapterType = typeof(MyHtmlFormAdapter);
HttpContext.Current.Request.Browser.Adapters[controlType.AssemblyQualifiedName]
                    = adapterType.AssemblyQualifiedName;
Daniel Crowe