views:

62

answers:

1

How do I check programmatically whether a web part is displayed in the shared resp. in personal mode.

+1  A: 

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
    }
  } 
}
Jason