WebPartPersonalization.IsModifiable 属性

定义

获取一个值,该值指示当前用户是否已授权可以修改状态信息。

public:
 property bool IsModifiable { bool get(); };
[System.ComponentModel.Browsable(false)]
public bool IsModifiable { get; }
[<System.ComponentModel.Browsable(false)>]
member this.IsModifiable : bool
Public ReadOnly Property IsModifiable As Boolean

属性值

如果用户已授权可以修改状态信息,则为 true;否则为 false

属性

示例

下面的代码演示如何使用 IsModifiable 属性。 此代码是类说明中较大代码示例的一 WebPartPersonalization 部分。

// Resets all of a user and shared personalization data for the page.
  protected void Reset_CurrentState_Button_Click(object src, EventArgs e)
  {
      // User must be authorized to modify state before a reset can occur.
      //When in user scope, all users by default can change their own data.
      if (_manager.Personalization.IsModifiable)
      {
          _manager.Personalization.ResetPersonalizationState();
      }
  }
' Resets all of a user and shared personalization data for the page.
Protected Sub Reset_CurrentState_Button_Click(ByVal src As Object, ByVal e As EventArgs) 
    ' User must be authorized to modify state before a reset can occur.
    'When in user scope, all users by default can change their own data.
    If _manager.Personalization.IsModifiable Then
        _manager.Personalization.ResetPersonalizationState()
    End If

End Sub 'Reset_CurrentState_Button_Click

注解

首次调用此属性时,它会缓存确定用户修改个性化设置状态的权利的结果。 UserCapabilities如果在首次调用此属性后修改字典,则更改不会反映在对此属性的后续调用中。

适用于

另请参阅