您的位置:首页 > 其它

判断webpart类型 How can I tell what type a web part is?

2013-08-09 09:49 295 查看
using(new SPSite("
http://mysite/myweb").OpenWeb()) {

//give relative path of the webpartpage
SPLimitedWebPartManager wm = page.GetLimitedWebPartManager("default.aspx",
System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);

foreach (System.Web.UI.WebControls.WebParts.WebPart wp in wm.WebParts)
{
}
}

if (wp.GetType().ToString() == "Microsoft.SharePoint.WebPartPages.SPUserCodeWebPart")
额,那你属性所有webpart的特点,争取一眼看出来

You can add
?contents=1
to the end of your page's URL to get a nice neat list of all the webparts that are currently opened and closed: http://sharepointsolutions.blogspot.com/2008/04/when-good-web-parts-go-bad.html

http://sharepoint.stackexchange.com/questions/9683/how-can-i-tell-what-type-a-web-part-is
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: