人是有惰性的

想到哪儿写到哪儿
动态生成用户控件
用户控件不能使用New来创建,目前还不知道是什么原因。

可以使用LoadControl,
                if ( !Page.IsPostBack )
                {
                    LinkUC oLink 
= (LinkUC)LoadControl("UCC/LinkUC.ascx");
                    oLink.NavUrl 
= "WebForm3.aspx";
                    Panel1.Controls.Add(oLink);
                }

同时调用页面要使用 Reference

<%@ Reference Control="~/UCC/LinkUC.ascx" %>


posted on 2007-07-29 16:34  guanfei  阅读(274)  评论(0)    收藏  举报