How to detect the view mode (PersonalizationScope) of a SharePoint WebPart
How do I check programmatically whether a web part is displa开发者_运维技巧yed in the shared resp. in personal mode.
The PersonalizationScope can be accessed like this:
public class MyWebPart: WebPart
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (WebPartManager.Personalization.Scope == PersonalizationScope.Shared)
{
// Do something
}
}
}
精彩评论