ProfileGroupBase.Item プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As ProfileGroupBase Dim propertyName As String Dim value As Object value = instance(propertyName) instance(propertyName) = value
public: property Object^ default [String^] { Object^ get (String^ propertyName); void set (String^ propertyName, Object^ value); }
/** @property */ public Object get_Item (String propertyName) /** @property */ public void set_Item (String propertyName, Object value)
- propertyName
グループ化されたプロファイル プロパティの名前。
指定されたグループ化済みプロファイル プロパティの値。

このプロパティを使用して、アプリケーションのユーザー プロファイルのグループ化されたプロパティ値を取得したり、設定したりできます。戻り値は Object として型が指定されているため、取得時に、特定のオブジェクト型としてキャストする必要があります。型を厳密に指定してプロファイル プロパティ値へアクセスするため、Profile.Address.City のような HttpContext.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>

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- ProfileGroupBase.Item プロパティのページへのリンク