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如果在第一次呼叫此屬性之後修改字典,則後續呼叫此屬性時不會反映變更。

適用於

另請參閱