ProfileGroupBase.GetPropertyValue メソッドとは? わかりやすく解説

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

ProfileGroupBase.GetPropertyValue メソッド

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

グループ化されたプロファイル プロパティの値を取得します。

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

Public Function GetPropertyValue ( _
    propertyName As String _
) As Object
Dim instance As ProfileGroupBase
Dim propertyName As String
Dim returnValue As Object

returnValue = instance.GetPropertyValue(propertyName)
public Object GetPropertyValue (
    string propertyName
)
public:
Object^ GetPropertyValue (
    String^ propertyName
)
public Object GetPropertyValue (
    String propertyName
)
public function GetPropertyValue (
    propertyName : String
) : Object

パラメータ

propertyName

グループ化されたプロファイル プロパティの名前。

戻り値
object として型指定されたグループ化済みプロファイル プロパティの値。

解説解説

ASP.NET は、ProfileBase クラスを使用して、ユーザー プロファイルのクラスを作成します。ユーザー プロファイルが有効にされたアプリケーションを起動すると、ASP.NET によって、ProfileBase クラスを継承する ProfileCommon 型の新しいクラスが作成されます。profile 要素 (ASP.NET 設定スキーマ) 構成セクションに定義されているそれぞれのグループとプロパティに対して、厳密に型指定されたアクセサが ProfileCommon クラスに追加されます。ProfileCommon クラスの厳密に型指定されたアクセサは、GetPropertyValue メソッドを呼び出して ProfileProvider から型指定されていない値を取得します。その際、生成されたアクセサが、取得した値を指定された型でキャストし、グループ化されたプロパティ値として返します。

GetPropertyValue メソッドを使用して、アプリケーションのユーザー プロファイルに対するグループ化されたプロパティ値を、名前によって取得できます。戻り値は object として型が指定されているため、取得時に、特定のオブジェクト型としてキャストする必要があります。型を厳密に指定してプロファイル プロパティ値へアクセスするため、Profile.Address.City などの Profile プロパティのグループ メンバとして、グループ化されたプロパティに名前でアクセスできます。

使用例使用例

ASP.NET ページが、ユーザー プロファイルに対して指定された、グループ化されたプロパティを読み込んだり、設定したりするコード例を次に示します。ユーザー プロファイルのグループ化されたプロパティを指定する Web.config ファイルの例については、ProfileGroupBase クラスの例を参照してください。

<%@ Page Language="VB" %>
<script runat="server">

Public Sub Page_Load()
  If Not IsPostBack Then
    StreetTextBox.Text          = Profile.Address.Street
    CityTextBox.Text            = Profile.Address.City
    StateTextBox.Text           = Profile.Address.State
    CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion
    ZipCodeTextBox.Text         = Profile.ZipCode
  End If
End Sub

Public Sub UpdateButton_OnClick(sender As
 Object, args As EventArgs)
  Profile.Address.Street          = StreetTextBox.Text
  Profile.Address.City            = CityTextBox.Text
  Profile.Address.State           = StateTextBox.Text
  Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text
  Profile.ZipCode                 = ZipCodeTextBox.Text
End Sub

</script>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<h3>Address Information for <%=User.Identity.Name%></h3>
<form runat="server">
  <table border=1 cellpadding=2 cellspacing=2>
    <tr>
      <td>Street Address</td>
      <td><asp:Textbox id="StreetTextBox"
 runat="server" columns="30"
 /></td>
    </tr>
    <tr>
      <td>City</td>
      <td><asp:Textbox id="CityTextBox" runat="server"
 columns="20" /></td>
    </tr>
    <tr>
      <td>State</td>
      <td><asp:Textbox id="StateTextBox"
 runat="server" columns="20"
 /></td>
    </tr>
    <tr>
      <td>Zip Code</td>
      <td><asp:Textbox id="ZipCodeTextBox"
 runat="server" columns="10"
 /></td>
    </tr>
    <tr>
      <td>Country</td>
      <td><asp:Textbox id="CountryOrRegionTextBox"
 runat="server" columns="20"
 /></td>
    </tr>
  </table>
  <asp:Button id="UpdateButton" runat="server"
 OnClick="UpdateButton_OnClick" Text="Update
 Address" />
</form>

</body>
</html>
<%@ Page Language="C#" %>
<script runat="server">

public void Page_Load()
{
  if (!IsPostBack)
  {
    StreetTextBox.Text          = Profile.Address.Street;
    CityTextBox.Text            = Profile.Address.City;
    StateTextBox.Text           = Profile.Address.State;
    CountryOrRegionTextBox.Text = Profile.Address.CountryOrRegion;
    ZipCodeTextBox.Text         = Profile.ZipCode;
  }
}

public void UpdateButton_OnClick(object sender,
 EventArgs args)
{
  Profile.Address.Street          = StreetTextBox.Text;
  Profile.Address.City            = CityTextBox.Text;
  Profile.Address.State           = StateTextBox.Text;
  Profile.Address.CountryOrRegion = CountryOrRegionTextBox.Text;
  Profile.ZipCode                 = ZipCodeTextBox.Text;
}

</script>
<html>
<head>
<title>Home Page</title>
</head>
<body>
<h3>Address Information for <%=User.Identity.Name%></h3>
<form runat="server">
  <table border=1 cellpadding=2 cellspacing=2>
    <tr>
      <td>Street Address</td>
      <td><asp:Textbox id="StreetTextBox" runat="server"
 columns="30" /></td>
    </tr>
    <tr>
      <td>City</td>
      <td><asp:Textbox id="CityTextBox" runat="server"
 columns="20" /></td>
    </tr>
    <tr>
      <td>State</td>
      <td><asp:Textbox id="StateTextBox" runat="server"
 columns="20" /></td>
    </tr>
    <tr>
      <td>Zip Code</td>
      <td><asp:Textbox id="ZipCodeTextBox" runat="server"
 columns="10" /></td>
    </tr>
    <tr>
      <td>Country</td>
      <td><asp:Textbox id="CountryOrRegionTextBox" runat="server"
 columns="20" /></td>
    </tr>
  </table>
  <asp:Button id="UpdateButton" runat="server" OnClick="UpdateButton_OnClick"
 Text="Update Address" />
</form>

</body>
</html>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

ProfileGroupBase.GetPropertyValue メソッドのお隣キーワード
検索ランキング

   

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



ProfileGroupBase.GetPropertyValue メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS