什么';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,如果它是一个实际的方法,它就不会那么可怕了。