开发者

How to detect the view mode (PersonalizationScope) of a SharePoint WebPart

开发者 https://www.devze.com 2022-12-29 10:01 出处:网络
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:

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

精彩评论

暂无评论...
验证码 换一张
取 消