日期:2014-05-18  浏览次数:20434 次

关于usercontrol的问题
主页面中有两个用户控件A、B,点击A中的不同链接,B控件动态加载不同的用户控件。
希望高手能提供能实现相关功能的代码

------解决方案--------------------
MyControl myControl = (MyControl)LoadControl( "../x/xxxx.ascx ");

Controls.Add(myControl);
------解决方案--------------------
pannel和占位符都可以实现。
UserControl uc = new UserControl();
UserControl uc1=uc.LoadControl( "~/AUserControl.ascx ") as UserControl;
this.Panel1.Controls.Add(uc1);