动态设置控制适配器

发布于 2024-07-15 08:56:58 字数 147 浏览 4 评论 0原文

在 ASP.Net 中,有没有一种方法可以动态设置控制适配器? 应用控制适配器的标准方法是通过“.browser”文件。 但是,我有一种情况,我想在某些情况下使用控制适配器,但在其他情况下不想使用 - 而且我找不到实现此目的的方法。

任何帮助表示赞赏。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

唱一曲作罢 2024-07-22 08:56:58

你想要的代码是:

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

The code you want is:

Type controlType = typeof(HtmlForm);
Type adapterType = typeof(MyHtmlFormAdapter);
HttpContext.Current.Request.Browser.Adapters[controlType.AssemblyQualifiedName]
                    = adapterType.AssemblyQualifiedName;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文