LoadControl - 来自字符串变量

发布于 2024-09-03 18:43:04 字数 80 浏览 0 评论 0原文

例如,如果我将控制标记保留在数据库中而不是 ascx 文件中。 如何从字符串常量加载控件?

(当然,如果我不想将副本保存到磁盘)

If e.g. I keep control markup in DB instead of ascx file.
How can I load control from string constant?

(of course if I don't want to save copy to disk)

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

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

发布评论

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

评论(1

逆光下的微笑 2024-09-10 18:43:04

呃……你真的不能。除非您的控件是服务器端控件,否则它会在 ASP.NET 网站启动时进行预编译。此外,数据库中存储的控件将无法具有子控件或标记数据绑定或数据集。

您实际上应该只将相关数据存储在数据库中并在页面中生成标记(如视图)。

Er... you can't really. Unless your control is a Server-Side control it's pre-compiled when the ASP.NET Website spins up. Also stored controls in a db wont be able to have sub-controls or markup-data-binding or data sets.

You should really only store the relevant data in the DB and generate markup in the page (like a view).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文