WebPartPersonalization クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebPartPersonalization クラスの意味・解説 

WebPartPersonalization クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

低レベルパーソナル化操作実装ます。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class WebPartPersonalization
Dim instance As WebPartPersonalization
public class WebPartPersonalization
public ref class WebPartPersonalization
public class WebPartPersonalization
public class WebPartPersonalization
解説解説

このクラスは、低レベルパーソナル化操作実行するために必要なロジック実装ます。WebPartManager クラスは、パーソナル化高レベル有効期間管理しますが、固有のパーソナル化操作必要な物ステップは、実際にWebPartPersonalization クラスによって実装されますまた、WebPartPersonalization クラスは、基になるデータ ストアとのパーソナル化情報通信を PersonalizationProvider の実装依存してます。

WebPartManager既定実装使用すると、Personalization プロパティ参照することで使用できる WebPartPersonalization クラスインスタンス作成されます。たとえば、InitialScope プロパティアクセスするためには、WebPartManager.Personalization.InitialScope指定します

継承時の注意 WebPartPersonalization クラスは、WebPartManager コントロールパーソナル化インフラストラクチャの他の部分と密接に連携します。パーソナル化既定実装は、パーソナル化要求を満たす非常に信頼性の高いサブシステムです。ほとんどの場合パーソナル化カスタマイズ必要なときには、PersonalizationProvider継承するクラス作成することによって、パーソナル化プロバイダとして使用するデータ プロバイダ作成できますWebPartPersonalization クラスWebPartManager クラスによって提供されるものとは大きく異なパーソナル化サブシステム作成するときは、WebPartPersonalization から派生させることによってカスタムWebPartPersonalization実装作成しカスタム ロジック追加する必要がありますその場合は、WebPartManager から派生させることによってカスタムWebPartManager実装作成しカスタム ロジック追加します。そして、CreatePersonalization メソッドオーバーライドしてカスタムWebPartPersonalization実装返しますWebPartManager コントロールWebPartPersonalizationインスタンス使用してパーソナル化インフラストラクチャ対す要求を行うため、WebPartManager コントロールが、PersonalizationProvider実装への参照直接やり取りしたり、この参照保持したりすることはありません。

使用例使用例

WebPartPersonalization クラス使用する方法を、次のコード例示しますまた、パーソナル化スコープが、パーソナル化されたプロパティ結果与え影響例について説明します。この例は、次の 5 つファイル構成されます。

次のコードでは、WebPartManager および 2 つWeb パーツ ゾーン使用する aspx ページ作成しColor.ascx コントロールおよび Persmode.ascx コントロール表示します。このページは、現在のユーザー情報取得するために使用されるログイン ページ読み込みます。Microsoft Visual Studio 2005ASP.NET Web サイト管理ツール使用してページアクセスするユーザー作成します構成ファイル内で、スコープ変更および状態情報変更のためにユーザー与えられる承認例については、web.config ファイル参照してください

<%@ Page Language="C#" %>
<%@ Register TagPrefix="control"  TagName="colorcontrol"
 Src="~/color.ascx"%>
<%@Register TagPrefix=pmode TagName=persmode Src="~/persMode.ascx"
 %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <!-- Create Web Part manager and zone for
 the color user control. -->
        <asp:WebPartManager ID="WebPartManager1"
 runat=server></asp:WebPartManager>
            <asp:WebPartZone ID="WebPartZone1"
 runat="server" HeaderText="Color
 Change Zone">
                <ZoneTemplate>
                <!-- Note that the control is Shared
 since it is declared on the page. -->
                    <control:colorcontrol id=color1 title="Color
 Control" runat=server />
                </ZoneTemplate>
            </asp:WebPartZone>
        
        <br />
            <!-- Create Web Part zone for the personalization
 mode user control. -->
            <asp:WebPartZone ID="WebPartZone2"
 runat="server" HeaderText="Scope
 Change Zone" Height="109px">
                <ZoneTemplate>
                    <pmode:persmode  ID="Persmode1"
 runat=server title="Scope Tool"/>
                </ZoneTemplate>
            </asp:WebPartZone>
   
    </form>
</body>
</html>
<%@ Page Language="C#" %>
<%@ Register TagPrefix="control"  TagName="colorcontrol" Src="~/color.ascx"%>
<%@Register TagPrefix=pmode TagName=persmode Src="~/persMode.ascx" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html  >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <!-- Create Web Part manager and zone for the color
 user control. -->
        <asp:WebPartManager ID="WebPartManager1" runat=server></asp:WebPartManager>
            <asp:WebPartZone ID="WebPartZone1" runat="server"
 HeaderText="Color Change Zone">
                <ZoneTemplate>
                <!-- Note that the control is Shared since it is declared on the
 page. -->
                    <control:colorcontrol id=color1 title="Color Control"
 runat=server />
                </ZoneTemplate>
            </asp:WebPartZone>
        
        <br />
            <!-- Create Web Part zone for the personalization
 mode user control. -->
            <asp:WebPartZone ID="WebPartZone2" runat="server"
 HeaderText="Scope Change Zone" Height="109px">
                <ZoneTemplate>
                    <pmode:persmode  ID="Persmode1" runat=server title="Scope
 Tool"/>
                </ZoneTemplate>
            </asp:WebPartZone>
   
    </form>
</body>
</html>

次のコードでは、ログイン ページ作成されます。ログイン成功すると、このページメインaspx ページにリダイレトされます

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html  >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Login ID="Login1" runat="server"
 BorderWidth="1px" BorderColor="#E6E2D8"
 BorderPadding="4"
            BorderStyle="Solid" BackColor="#F7F6F3"
 ForeColor="#333333" Font-Names="Verdana"
            Font-Size="0.8em" DestinationPageUrl="~/Defaultvb.aspx">
            <InstructionTextStyle ForeColor="Black"
 Font-Italic="True" Font-Size="0.8em"
 />
            <LoginButtonStyle Font-Names="Verdana"
 Font-Size="0.8em" BorderStyle="Solid"
 BorderWidth="1px"
                BorderColor="#CCCCCC" BackColor="#FFFBFF"
 ForeColor="#284775" />
            <TextBoxStyle Font-Size="0.8em" />
            <LabelStyle Font-Size="0.8em" />
            <TitleTextStyle ForeColor="White" Font-Size="0.9em"
 Font-Bold="True" BackColor="#5D7B9D"
 />
            <HyperLinkStyle Font-Size="0.8em" />
            <CheckBoxStyle Font-Size="0.8em" />
            <FailureTextStyle ForeColor="#FF0000"
 Font-Size="0.8em" />
        </asp:Login>   
    </div>
    </form>
You can create new users with the ASP.NET Web
 Site Administration Tool in Microsoft Visual Studio 2005. 
See also the web.config file for user authorization examples.
</body>
</html>
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

</script>

<html  >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Login ID="Login1" runat="server" BorderWidth="1px"
 BorderColor="#E6E2D8" BorderPadding="4"
            BorderStyle="Solid" BackColor="#F7F6F3" ForeColor="#333333"
 Font-Names="Verdana"
            Font-Size="0.8em" DestinationPageUrl="~/Defaultcs.aspx">
            <InstructionTextStyle ForeColor="Black" Font-Italic="True"
 Font-Size="0.8em" />
            <LoginButtonStyle Font-Names="Verdana" Font-Size="0.8em"
 BorderStyle="Solid" BorderWidth="1px"
                BorderColor="#CCCCCC" BackColor="#FFFBFF" ForeColor="#284775"
 />
            <TextBoxStyle Font-Size="0.8em" />
            <LabelStyle Font-Size="0.8em" />
            <TitleTextStyle ForeColor="White" Font-Size="0.9em"
 Font-Bold="True" BackColor="#5D7B9D" />
            <HyperLinkStyle Font-Size="0.8em" />
            <CheckBoxStyle Font-Size="0.8em" />
            <FailureTextStyle ForeColor="#FF0000" Font-Size="0.8em"
 />
        </asp:Login>   
    </div>
    </form>
You can create new users with the ASP.NET Web Site Administration
 Tool in Microsoft Visual Studio 2005. 
See also the web.config file for user authorization examples.
</body>
</html>

次のコードは、web.config ファイルでこのアプリケーションに関する部分です。このセクションでは、この例で "user2" となっているユーザーに、共有パーソナル化スコープ入力およびパーソナル化状態情報変更のための承認設定する方法示しますまた、この例で "admin" となっているロールの例も示します。"admin" は、このロール属すユーザー共有パーソナル化スコープ入力およびパーソナル化状態情報変更を行うことができるようにします。

<webParts>
    <personalization defaultProvider="AspNetSqlPersonalizationProvider">
        <authorization>
            <allow users="user2" verbs="enterSharedScope,
 modifyState"/>
            <allow roles="admin" verbs="enterSharedScope,
 modifyState"/>
        </authorization>
    </personalization>
</webParts>
<webParts>
    <personalization defaultProvider="AspNetSqlPersonalizationProvider">
        <authorization>
            <allow users="user2" verbs="enterSharedScope, modifyState"/>
            <allow roles="admin" verbs="enterSharedScope, modifyState"/>
        </authorization>
    </personalization>
</webParts>

次のコードでは、Color.ascx という名前のユーザー コントロール作成します。このコントロールにより、ユーザー現在のパーソナル化スコープユーザー権限承認基づいてパーソナル化されたプロパティ (この例では 2 つテキスト ボックス背景色) を変更できるようになります

<%@ Control Language="VB" %>

<html>
<script runat=server>
     ' User a field to reference the current WebPartManager.
Private _manager As WebPartManager

'  Defines personalized property for User scope. In this case, the property
 is
'   the background color of the text box.

<Personalizable(PersonalizationScope.User)>  _
Public Property UserColorChoice() As
 System.Drawing.Color 
    Get
        Return _coloruserTextBox.BackColor
    End Get
    Set
        _coloruserTextBox.BackColor = value
    End Set
End Property

' Defines personalized property for Shared scope. In this case, the
 property is
'   the background color of the text box.

<Personalizable(PersonalizationScope.Shared)>  _
Public Property SharedColorChoice() As
 System.Drawing.Color 
    Get
        Return _colorsharedTextBox.BackColor
    End Get
    Set
        _colorsharedTextBox.BackColor = value
    End Set
End Property



Sub Page_Init(ByVal sender As
 Object, ByVal e As EventArgs)
 
    _manager = WebPartManager.GetCurrentWebPartManager(Page)

End Sub 'Page_Init


Protected Sub Page_Load(ByVal
 src As Object, ByVal e
 As EventArgs) 
    ' If Web Parts manager scope is User, hide the button that changes
 shared control.
    If _manager.Personalization.Scope = PersonalizationScope.User
 Then
        _sharedchangeButton.Visible = False
        If Not _manager.Personalization.IsModifiable
 Then
            _userchangeButton.Enabled = False
        End If
    Else
        _sharedchangeButton.Visible = True
        If Not _manager.Personalization.IsModifiable
 Then
            _sharedchangeButton.Enabled = False
            _userchangeButton.Enabled = False
        End If
    End If

End Sub 'Page_Load
 
' Changes color of the User text box background when button clicked
 by authorized user.
Protected Sub _userButton_Click(ByVal
 src As Object, ByVal e
 As EventArgs) 
    Select Case _coloruserTextBox.BackColor.Name
        Case "Red"
            _coloruserTextBox.BackColor = System.Drawing.Color.Yellow
        Case "Yellow"
            _coloruserTextBox.BackColor = System.Drawing.Color.Green
        Case "Green"
            _coloruserTextBox.BackColor = System.Drawing.Color.Red
    End Select

End Sub '_userButton_Click


' Changes color of the Shared text box background when button clicked
 by authorized user.
Protected Sub _sharedButton_Click(ByVal
 src As Object, ByVal e
 As EventArgs) 
    Select Case _colorsharedTextBox.BackColor.Name
        Case "Red"
            _colorsharedTextBox.BackColor = System.Drawing.Color.Yellow
        Case "Yellow"
            _colorsharedTextBox.BackColor = System.Drawing.Color.Green
        Case "Green"
            _colorsharedTextBox.BackColor = System.Drawing.Color.Red
    End Select

End Sub '_sharedButton_Click

</script>
<body>
<p>
    <asp:LoginName ID="LoginName1" runat="server"
 BorderWidth=500 BorderStyle=none />
    <asp:LoginStatus ID="LoginStatus1" LogoutAction=RedirectToLoginPage
 runat="server" />
</p>
    <asp:Label ID="ScopeLabel" Text="Scoped
 Properties:" runat=server Width="289px"></asp:Label>
    <br />
    <p>
        <table style="width: 226px">
            
            <tr>
                <td>
                    <asp:TextBox ID="_coloruserTextBox"
 Font-Bold="True" Height="110px"
 
                    runat="server" Text="User
 Property" BackColor=red Width="110px"
 /> 
                </td>
                <td>       
                    <asp:TextBox ID=_colorsharedTextBox runat=server Height=110px
 
                    Width=110px Text="Shared Property"
 BackColor=red Font-Bold=true />
                </td>
           </tr>
            <tr>
                <td>
                    <asp:Button Text="Change User Color"
 ID=_userchangeButton 
                    runat=server OnClick="_userButton_Click"
 />
                </td>
                <td >
                    <asp:Button Text="Change Shared Color"
 ID=_sharedchangeButton 
                    runat=server OnClick="_sharedButton_Click"
 />
                </td>
            </tr>
        </table>
    </p>
 
</body>
</html>
<%@ Control Language="C#" %>

<html>
<script runat=server>
    // User a field to reference the current WebPartManager.
    private WebPartManager _manager;
    
    //  Defines personalized property for User scope. In this case,
 the property is
    //   the background color of the text box.
    [Personalizable(PersonalizationScope.User)]
    public System.Drawing.Color UserColorChoice
    {
        get
        {
            return _coloruserTextBox.BackColor;
        }
        set
        {
            _coloruserTextBox.BackColor = value;
        }
    }

    // Defines personalized property for Shared scope. In this case,
 the property is
    //   the background color of the text box.
    [Personalizable(PersonalizationScope.Shared) ]
    public System.Drawing.Color SharedColorChoice
    {
        get
        {
            return _colorsharedTextBox.BackColor;
        }
        set
        {
            _colorsharedTextBox.BackColor = value;
        }
    }


    void Page_Init(object sender, EventArgs e)
    {
       _manager = WebPartManager.GetCurrentWebPartManager(Page);       
    }

    protected void Page_Load(object src, EventArgs
 e) 
    {
     // If Web Parts manager scope is User, hide the button that changes
 shared control.
       if (_manager.Personalization.Scope == PersonalizationScope.User)
       {
           _sharedchangeButton.Visible = false;
                  if (!_manager.Personalization.IsModifiable)
                      _userchangeButton.Enabled = false;
       }
       else
       {
           _sharedchangeButton.Visible = true; 
                  if (!_manager.Personalization.IsModifiable)
                    {
                      _sharedchangeButton.Enabled = false;
                      _userchangeButton.Enabled = false;
                    }
       } 
    }
    
    // Changes color of the User text box background when button clicked
 by authorized user.
    protected void _userButton_Click(object
 src, EventArgs e)
    {
        switch(_coloruserTextBox.BackColor.Name)
        {
            case "Red":
                _coloruserTextBox.BackColor = System.Drawing.Color.Yellow;
                break;
            case "Yellow":
                _coloruserTextBox.BackColor = System.Drawing.Color.Green;
                break;
            case "Green":
                _coloruserTextBox.BackColor = System.Drawing.Color.Red;
                break;
        }
    }
        
    // Changes color of the Shared text box background when button clicked
 by authorized user.
    protected void _sharedButton_Click(object
 src, EventArgs e)
    {
        switch (_colorsharedTextBox.BackColor.Name)
        {
            case "Red":
                _colorsharedTextBox.BackColor = System.Drawing.Color.Yellow;
                break;
            case "Yellow":
                _colorsharedTextBox.BackColor = System.Drawing.Color.Green;
                break;
            case "Green":
                _colorsharedTextBox.BackColor = System.Drawing.Color.Red;
                break;
        }        
    }   

</script>
<body>
<p>
    <asp:LoginName ID="LoginName1" runat="server" BorderWidth=500
 BorderStyle=none />
    <asp:LoginStatus ID="LoginStatus1" LogoutAction=RedirectToLoginPage
 runat="server" />
</p>
    <asp:Label ID="ScopeLabel" Text="Scoped Properties:" runat=server
 Width="289px"></asp:Label>
    <br />
    <p>
        <table style="width: 226px">
            
            <tr>
                <td>
                    <asp:TextBox ID="_coloruserTextBox" Font-Bold="True"
 Height="110px" 
                    runat="server" Text="User Property" BackColor=red
 Width="110px" /> 
                </td>
                <td>       
                    <asp:TextBox ID=_colorsharedTextBox runat=server Height=110px
 
                    Width=110px Text="Shared Property" BackColor=red Font-Bold=true
 />
                </td>
           </tr>
            <tr>
                <td>
                    <asp:Button Text="Change User Color" ID=_userchangeButton
 
                    runat=server OnClick="_userButton_Click" />
                </td>
                <td >
                    <asp:Button Text="Change Shared Color" ID=_sharedchangeButton
 
                    runat=server OnClick="_sharedButton_Click" />
                </td>
            </tr>
        </table>
    </p>
 
</body>
</html>

次のコードでは、Persmode.ascx という名前のユーザー コントロール作成します。このコントロールは、現在のパーソナル化スコープと、状態の変更および共有スコープ入力を行うユーザー権限示しますまた、このコントロールには、現在のパーソナル化状態をリセットするためのリセット ボタンあります

<%@ control language="VB" %>

<script runat="server">
  
  ' Use a field to reference the current WebPartManager.
Private _manager As WebPartManager


Protected Sub Page_Load(ByVal
 src As Object, ByVal e
 As EventArgs) 
    ' Get the current Web Parts manager.
    _manager = WebPartManager.GetCurrentWebPartManager(Page)
    
    ' All radio buttons are disabled; the button settings show what
 the current state is.
    EnterSharedRadioButton.Enabled = False
    ModifyStateRadioButton.Enabled = False
    
    ' If Web Parts manager is in User scope, set scope button.
    If _manager.Personalization.Scope = PersonalizationScope.User
 Then
        UserScopeRadioButton.Checked = True
    Else
        SharedScopeRadioButton.Checked = True
    End If 
    ' Based on current user rights to enter Shared scope, set buttons.
    If _manager.Personalization.CanEnterSharedScope Then
        EnterSharedRadioButton.Checked = True
        No_Shared_Scope_Label.Visible = False
        Toggle_Scope_Button.Enabled = True
    Else
        EnterSharedRadioButton.Checked = False
        No_Shared_Scope_Label.Visible = True
        Toggle_Scope_Button.Enabled = False
    End If
    
    ' Based on current user rights to modify personalization state,
 set buttons.
    If _manager.Personalization.IsModifiable Then
        ModifyStateRadioButton.Checked = True
        Reset_User_Button.Enabled = True
    Else
        ModifyStateRadioButton.Checked = False
        Reset_User_Button.Enabled = False
    End If

End Sub 'Page_Load

' 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

' Allows authorized user to change personalization scope.
Protected Sub Toggle_Scope_Button_Click(ByVal
 sender As Object, ByVal
 e As EventArgs) 
    If _manager.Personalization.CanEnterSharedScope Then
        _manager.Personalization.ToggleScope()
    End If

End Sub 'Toggle_Scope_Button_Click
 
</script>
<div>
    &nbsp;<asp:Panel ID="Panel1" runat="server"
 
    Borderwidth="1" 
    Width="208px" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" Height="214px"
 >
    <asp:Label ID="Label1" runat="server"
 
      Text="Page Scope" 
      Font-Bold="True"
      Font-Size="8pt"
      Width="120px" />&nbsp;<br />
    
    
      <asp:RadioButton ID="UserScopeRadioButton"
 runat="server" 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope"  
         Enabled=false />
      <asp:RadioButton ID="SharedScopeRadioButton"
 runat="server" 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        Enabled=false />
        <br />
        <asp:Label BorderStyle="None" Font-Bold="True"
 Font-Names="Courier New" ID="No_Shared_Scope_Label"
 Font-Size=Smaller ForeColor=red
           runat="server" Visible=false Width="179px">User
 cannot enter Shared scope</asp:Label>
        <br />
        <asp:Label ID="Label2" runat="server"
 
      Text="Current User Can:" 
      Font-Bold="True"
      Font-Size="8pt"
      Width="165px" />
      <br />
        <asp:RadioButton ID="ModifyStateRadioButton"
 runat="server" 
        Text="Modify State" Width="138px"
 />
        <br />
        <asp:RadioButton ID="EnterSharedRadioButton"
 runat="server" 
        Text="Enter Shared Scope" 
        AutoPostBack="true"  />&nbsp;<br />
        <br />
        <asp:Button ID="Toggle_Scope_Button" OnClick="Toggle_Scope_Button_Click"
 runat="server"
            Text="Change Scope" Width="186px"
 /><br />
        <br />
        <asp:Button ID="Reset_User_Button" OnClick="Reset_CurrentState_Button_Click"
 runat="server"
            Text="Reset Current Personalization" Width="185px"
 /></asp:Panel>
    &nbsp; &nbsp;
</div>
<%@ control language="C#" %>

<script runat="server">
  
 // Use a field to reference the current WebPartManager.
  private WebPartManager _manager;

    protected void Page_Load(object src, EventArgs
 e)
    {
        // Get the current Web Parts manager.
        _manager = WebPartManager.GetCurrentWebPartManager(Page);
        
        // All radio buttons are disabled; the button settings show
 what the current state is.
        EnterSharedRadioButton.Enabled = false;
        ModifyStateRadioButton.Enabled = false;

        // If Web Parts manager is in User scope, set scope button.
        if (_manager.Personalization.Scope == PersonalizationScope.User)
            UserScopeRadioButton.Checked = true;
        else
            SharedScopeRadioButton.Checked = true;

        // Based on current user rights to enter Shared scope, set buttons.
        if (_manager.Personalization.CanEnterSharedScope)
        {
            EnterSharedRadioButton.Checked = true;
            No_Shared_Scope_Label.Visible = false;
            Toggle_Scope_Button.Enabled = true;
        }
        else
        {
            EnterSharedRadioButton.Checked = false;
            No_Shared_Scope_Label.Visible = true;
            Toggle_Scope_Button.Enabled = false;
        }

        // Based on current user rights to modify personalization state,
 set buttons.
        if (_manager.Personalization.IsModifiable)
        {
            ModifyStateRadioButton.Checked = true;
            Reset_User_Button.Enabled = true;
        }
        else
        {
            ModifyStateRadioButton.Checked = false;
            Reset_User_Button.Enabled = false;
        }
    }
  // 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();
        }
    }

    // Allows authorized user to change personalization scope.
    protected void Toggle_Scope_Button_Click(object
 sender, EventArgs e)
    {
        if (_manager.Personalization.CanEnterSharedScope)
        {
            _manager.Personalization.ToggleScope();
        }
        
    }
</script>
<div>
    &nbsp;<asp:Panel ID="Panel1" runat="server" 
    Borderwidth="1" 
    Width="208px" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" Height="214px" >
    <asp:Label ID="Label1" runat="server" 
      Text="Page Scope" 
      Font-Bold="True"
      Font-Size="8pt"
      Width="120px" />&nbsp;<br />
    
    
      <asp:RadioButton ID="UserScopeRadioButton" runat="server"
 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope"  
         Enabled=false />
      <asp:RadioButton ID="SharedScopeRadioButton" runat="server"
 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        Enabled=false />
        <br />
        <asp:Label BorderStyle="None" Font-Bold="True" Font-Names="Courier
 New" ID="No_Shared_Scope_Label" Font-Size=Smaller ForeColor=red
           runat="server" Visible=false Width="179px">User
 cannot enter Shared scope</asp:Label>
        <br />
        <asp:Label ID="Label2" runat="server" 
      Text="Current User Can:" 
      Font-Bold="True"
      Font-Size="8pt"
      Width="165px" />
      <br />
        <asp:RadioButton ID="ModifyStateRadioButton" runat="server"
 
        Text="Modify State" Width="138px" />
        <br />
        <asp:RadioButton ID="EnterSharedRadioButton" runat="server"
 
        Text="Enter Shared Scope" 
        AutoPostBack="true"  />&nbsp;<br />
        <br />
        <asp:Button ID="Toggle_Scope_Button" OnClick="Toggle_Scope_Button_Click"
 runat="server"
            Text="Change Scope" Width="186px" /><br />
        <br />
        <asp:Button ID="Reset_User_Button" OnClick="Reset_CurrentState_Button_Click"
 runat="server"
            Text="Reset Current Personalization" Width="185px"
 /></asp:Panel>
    &nbsp; &nbsp;
</div>
.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
  System.Web.UI.WebControls.WebParts.WebPartPersonalization
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「WebPartPersonalization クラス」の関連用語

WebPartPersonalization クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebPartPersonalization クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS