当前位置: 代码迷 >> ASP.NET >> asp.net 中如何动态添加web用户控件?
  详细解决方案

asp.net 中如何动态添加web用户控件?

热度:7805   发布时间:2013-02-26 00:00:00.0
asp.net 中怎么动态添加web用户控件????????????????????
asp.net   中怎么动态添加web用户控件?
比如:页面上有一个Panel1   ,
现在想动态的向Panel1中添加web用户控件(Usercount),
问题是web用户控件不能new出来。
谁知道??who...


------解决方案--------------------------------------------------------


<asp:PlaceHolder id= "MbShow " runat= "server "> </asp:PlaceHolder>
Control userControl = new Control();
userControl = LoadControl( "Usercount.ascx ");
MbShow.Controls.Add(userControl);
------解决方案--------------------------------------------------------
同上
  相关解决方案