日期:2014-05-19  浏览次数:20366 次

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);
------解决方案--------------------
同上