Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么';s ASP.NET方法通过解析字符串来加载服务器控件_Asp.net_Servercontrol_Parsecontrol - Fatal编程技术网

什么';s ASP.NET方法通过解析字符串来加载服务器控件

什么';s ASP.NET方法通过解析字符串来加载服务器控件,asp.net,servercontrol,parsecontrol,Asp.net,Servercontrol,Parsecontrol,我相信我已经看到了这样做的方法,但我不记得了 我正在尝试使用以下方式加载控件: string str = "<asp:label id=\"myLabel\" runat=\"server\" />"; Control ctrl = SomeMagicalLoadControlMethod(str); Page.controls.add(ctrl); string str=”“; Control ctrl=SomeMagicalLoadControlMethod(str); Pa

我相信我已经看到了这样做的方法,但我不记得了

我正在尝试使用以下方式加载控件:

string str = "<asp:label id=\"myLabel\" runat=\"server\" />";

Control ctrl = SomeMagicalLoadControlMethod(str);
Page.controls.add(ctrl);
string str=”“;
Control ctrl=SomeMagicalLoadControlMethod(str);
Page.controls.add(ctrl);
有什么办法吗

是的,我熟悉LoadControl方法,但这不是我需要的

更新:

我想到的方法是ParseControl

去帮助其他人

Control ctrl = ParseControl("<asp:label id=\"myLabel\" runat=\"server\" />");
Control ctrl=ParseControl(“”);

我无法想象会做你所描述的事情。这看起来像是一件可怕的事情,如果真的有可能的话,我宁愿忘记我看到了它,重新思考我的方法。

看起来他想做一些动态控制的事情。但是最好签出任何MVC框架,并最终添加一个客户机MVC,比如ExtJS……我想到的方法是ParseControl,如果它是一个实际的方法,它就不会那么可怕了。