动态载入.ascx用户控件

aspx部分

 

<body>
<div id="div1" runat="server">
</div>
</body>

 

 

.cs部分

 

 protected void Page_Load(object sender, EventArgs e)
 {

WebUserControl1 control
= (WebUserControl1)Page.LoadControl("WebUserControl1.ascx");
 
this.div1.Controls.Add(control);

}

 

posted on 2011-05-09 21:09  上校  阅读(194)  评论(0编辑  收藏  举报