【发布时间】:2012-01-20 19:49:20
【问题描述】:
我有一个从 http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webpartpages.webpart.aspx 修改的代码 sn-p :
public class WebPartBla : Microsoft.SharePoint.WebPartPages.WebPart
{
private ArrayList someList;
protected override void CreateChildControls()
{
someList = new ArrayList();
SPWeb myWeb = SPControl.GetContextWeb(this.Context);
foreach(SPList list in myWeb.Lists)
{
if (list.BaseTemplate == SPListTemplateType.Tasks)
{
someList(list.Description);
}
}
}
/// <summary>
/// Render this Web Part to the output parameter specified.
/// </summary>
/// <param name="output"> The HTML writer to write out to </param>
protected override void RenderWebPart(HtmlTextWriter output)
{
string strHTML = "";
for (int i = 0; i < someList.Count; i++)
{
strHTML = strHTML + "The task " + someList.Description + "<BR><BR>";
}
output.Write(strHTML);
}
}
谁能帮帮我
- 如何将此代码用作 SharePoint Web 部件?
- 如何将其作为 Web 部件部署到共享点?
- 上面的 RenderWebPart 方法如何使用?
【问题讨论】:
标签: c# sharepoint web-parts