我想在ascx控件code存储到数据库中。然后,而不是从加载文件路径位置的控制,我想从数据库中检索,并将其加载到用户控件。该UserControl.LoadControl只有两个选择超载。如果没有从数据库中保存的控制到一个临时文件,然后从临时文件加载,是有可能做到这一点直接从数据库?
I would like to store the ascx control code into a database. Then rather then load the control from a filepath location, I would like to retrieve it from the database and load it into the UserControl. The UserControl.LoadControl only has two overload options. Without saving the control from a database to a temporary file and then load from the temporary file, is it possible do this direct from the database?
推荐答案您可以使用 ParseControl 呢? 链接到MSDN。
Can you use ParseControl instead? Link to MSDN.
该方法接受一个字符串,然后在飞行中为控制对象进行编译。
The method accepts a string that is then compiled on the fly as a Control object.
您可以从数据库中加载您的控制标记,然后将它交给 ParseControl 让你控制的实例了。
You could load your control markup from the database and then hand it off to ParseControl to get an instance of your control back.
希望这有助于!
更多推荐
存储在数据库ASCX
发布评论