SharePoint.Net

『笔记』Webpart加载*.ascx页面转换代码

替换 xxxx.cs 文件中的RenderWebPart()方法。代码如下:

protected override void RenderWebPart(HtmlTextWriter output)
{
    
this.EnsureChildControls();
    _innerWebControl.RenderControl(output);
}


private System.Web.UI.Control _innerWebControl;

protected override void CreateChildControls()
{
    _innerWebControl
=this.Page.LoadControl("/bin/WebUserControlTest.ascx");
    
this.Controls.Add(_innerWebControl);
    
base.CreateChildControls ();
}

其中 LoadControl("/bin/WebUserControlTest.ascx") 就是要加载的 *.ascx 文件名了。

posted on 2006-03-21 16:41  Viva  阅读(945)  评论(1编辑  收藏  举报

导航