悬赏园豆:100
[已关闭问题]
<P>页面开发中用到了自定义页面 :</P>
<P><asp:CatalogZone ID="CatalogZone1" runat="server"><BR> <ZoneTemplate><BR> <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" runat="server" OnLoad="DeclarativeCatalogPart1_Load"> <BR> <WebPartsTemplate> <BR> <BR> </WebPartsTemplate><BR> </asp:DeclarativeCatalogPart> </ZoneTemplate><BR> </asp:CatalogZone> </P>
<P> </P>
<P>其中WebPartsTemplate标记中是要添加自定义控件的地方,如果我添加以下代码</P>
<P> <uc1:ReportNamelist ID="ReportNamelist1" runat="server" Title = "dadfada"/></P>
<P>则可以通过 但是如果我在后台添加时候则不能显示,却是为何?</P>
<P><BR> public class CustomWebPartTemplate : ITemplate<BR> {<BR> private WebPartManager manger = new WebPartManager();<BR> private Page p = new Page();<BR> public void InstantiateIn(Control container)<BR> {<BR> DataTable dt = BLL.CommonClass.ExcelOperate.GetAllExcelFile(userid).Tables[0];<BR> //DataTable dt = ExcelOperate.GetAlltablename().Tables[0];<BR> if (dt.Rows.Count > 0)<BR> {<BR> for (int i = 0; i < dt.Rows.Count; i++)<BR> {<BR> int id = Convert.ToInt32(dt.Rows[i][0].ToString());<BR> if (id > 0)<BR> {<BR> ReportNamelist re = (ReportNamelist)p.LoadControl("/PageLayout/ReportNamelist.ascx");<BR> &n