ProfileBase.Properties プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ProfileBase.Properties プロパティの意味・解説 

ProfileBase.Properties プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

プロファイル内のプロパティ対する SettingsProperty オブジェクトから成るコレクション取得します

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

Public Shared ReadOnly Property
 Properties As SettingsPropertyCollection
Dim value As SettingsPropertyCollection

value = ProfileBase.Properties
public static SettingsPropertyCollection Properties
 { get; }
public:
static property SettingsPropertyCollection^ Properties {
    SettingsPropertyCollection^ get ();
}
/** @property */
public static SettingsPropertyCollection get_Properties
 ()
public static function get
 Properties () : SettingsPropertyCollection

プロパティ
アプリケーションプロファイルの各プロパティ対すSettingsProperty オブジェクトから成る SettingsPropertyCollection。

例外例外
解説解説
使用例使用例

次のコード例では、SettingsProperty オブジェクト静的Properties コレクションからの Name プロパティを GridView コントロールバインドすることで、ユーザー プロファイル内のプロパティ名を一覧表示します選択されプロパティ値を、Item コレクション使用して名前で取得しますユーザー プロファイルプロパティ指定する Web.config ファイルの例については、ProfileBase クラスの例を参照してください

<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Profile"
 %>

<script runat="server">

Public Sub Page_Load()

  If Not IsPostBack Then
    PropertiesListBox.DataSource = ProfileBase.Properties
    PropertiesListBox.DataBind()
  End If

  If Not PropertiesListBox.SelectedItem Is
 Nothing Then
    Dim propValue As Object
 = Profile(PropertiesListBox.SelectedItem.Text)

    Dim propType As Type = propValue.GetType()

    ' If the property is a value type, return ToString().

    If propType Is GetType(String)
 Or propType.IsValueType Then
      ValueLabel.Visible = True
      ValueGridView.Visible = False
      ValueLabel.Text = propValue.ToString()
      Return
    End If


    ' Bind the property to a GridView.

    Try
      ValueGridView.DataSource = propValue
      ValueGridView.DataBind()
      ValueGridView.Visible = True
      ValueLabel.Visible = False 
    Catch
      ' If the property is not bindable, return ToString().

      ValueLabel.Visible = True
      ValueGridView.Visible = False
      ValueLabel.Text = propValue.ToString()
    End Try
  End If
End Sub

</script>
<html>
<head>
<title>Home Page</title>
</head>
<body>

<h3>View Profile properties:</h3>

<form runat="server">
  <table border=0 cellpadding=2 cellspacing=2>
    <tR>
      <td>Property</td>
      <td>Value</td>
    </tR>
    <tr>
      <td valign="top">
        <asp:ListBox runat="server" id="PropertiesListBox"
 Rows="10" AutoPostBack="True"
 DataTextField="Name" />
      </td>
      <td valign="top">
        <asp:GridView runat="Server" id="ValueGridView"
 Visible="False" />
        <asp:Label runat="Server" id="ValueLabel"
 Visible="False" />
      </td>
    </tr>
  </table>
</form>

</body>
</html>
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Web.Profile" %>

<script runat="server">

public void Page_Load()
{
  if (!IsPostBack)
  {
    PropertiesListBox.DataSource = ProfileBase.Properties;
    PropertiesListBox.DataBind();
  }

  if (PropertiesListBox.SelectedItem != null)
  {
    object propValue = Profile[PropertiesListBox.SelectedItem.Text];

    Type propType = propValue.GetType();

    // If the property is a value type, return ToString().

    if (propType == typeof(string) || propType.IsValueType)
    {
      ValueLabel.Visible = true;
      ValueGridView.Visible = false;
      ValueLabel.Text = propValue.ToString();
      return;
    }


    // Bind the property to a GridView.

    try
    {
      ValueGridView.DataSource = propValue;
      ValueGridView.DataBind();
      ValueGridView.Visible = true;
      ValueLabel.Visible = false; 
    }
    catch
    {
      // If the property is not bindable, return ToString().

      ValueLabel.Visible = true;
      ValueGridView.Visible = false;
      ValueLabel.Text = propValue.ToString();
    }
  }
}

</script>
<html>
<head>
<title>Home Page</title>
</head>
<body>

<h3>View Profile properties:</h3>

<form runat="server">
  <table border=0 cellpadding=2 cellspacing=2>
    <tR>
      <td>Property</td>
      <td>Value</td>
    </tR>
    <tr>
      <td valign="top">
        <asp:ListBox runat="server" id="PropertiesListBox"
 Rows="10" AutoPostBack="True" DataTextField="Name"
 />
      </td>
      <td valign="top">
        <asp:GridView runat="Server" id="ValueGridView" Visible="False"
 />
        <asp:Label runat="Server" id="ValueLabel" Visible="False"
 />
      </td>
    </tr>
  </table>
</form>

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


このページでは「.NET Framework クラス ライブラリ リファレンス」からProfileBase.Properties プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からProfileBase.Properties プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からProfileBase.Properties プロパティ を検索

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

辞書ショートカット

すべての辞書の索引

「ProfileBase.Properties プロパティ」の関連用語

ProfileBase.Properties プロパティのお隣キーワード
検索ランキング

   

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



ProfileBase.Properties プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS