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

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

FormViewDeleteEventArgs.Values プロパティ

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

削除する項目のキー以外のフィールドの名前と値のペアのディクショナリを取得します

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

Dim instance As FormViewDeleteEventArgs
Dim value As IOrderedDictionary

value = instance.Values
public IOrderedDictionary Values { get; }
public:
property IOrderedDictionary^ Values {
    IOrderedDictionary^ get ();
}
/** @property */
public IOrderedDictionary get_Values ()
public function get Values
 () : IOrderedDictionary

プロパティ
削除する項目のキー以外のフィールドの名前と値のペア格納している OrderedDictionary。

解説解説

Values プロパティ使用して削除されるレコードキー以外のフィールドの値にアクセスます。たとえば、これらの値を使用して削除する前にレコード検証したり、削除されレコードログ維持したできます

メモメモ

このプロパティには、1 つ上のキー フィールド格納されません。1 つ上のキー フィールドの値の名前と値のペアアクセスするには、Keys プロパティ使用します

Values プロパティは、System.Collections.Specialized.IOrderedDictionary インターフェイス実装する OrderedDictionary オブジェクト返しますOrderedDictionary オブジェクトには、キー以外のフィールドを表す System.Collections.DictionaryEntry オブジェクト格納されます。フィールド名にアクセスするには、OrderedDictionary オブジェクトKeys プロパティ使用します同様にValues プロパティ使用してフィールド値にアクセスできます

Values コレクションの値は、データ ソース コントロール渡されません。これらの値をデータ ソース反映する必要がある場合は、これらの値を Keys コレクション追加する必要があります

Keys プロパティValues プロパティ読み取り専用です。ただし、OrderedDictionary オブジェクトフィールド値は変更できますキー フィールドの値およびキー以外のフィールドの値を変更すると、対応するレコードデータ ソースから削除されます。

使用例使用例

Values プロパティ使用して削除されるレコードキー以外のフィールドの値にアクセスする方法次の例に示します

<%@ Page language="VB" %>

<script runat="server">

  Sub EmployeeFormView_ItemDeleting(ByVal sender
 As Object, ByVal e As
 FormViewDeleteEventArgs)
  
    ' Get the employee ID, name, and job title from the Keys and Values
    ' properties.
    Dim keyValue As String
 = e.Keys("EmployeeID").ToString()
    Dim employeeName As String
 = e.Values("FirstName").ToString() & _
      " " & e.Values("LastName").ToString()
    Dim title As String
 = e.Values("Title").ToString()

    ' Cancel the delete operation if the user attempts to 
    ' delete a protected record. In this example, records for
    ' employees with a "Sales Manager" job title are protected.
    If Title.Equals("Sales Manager")
 Then
    
      e.Cancel = True
      MessageLabel.Text = "You cannot delete record "
 & _
        e.RowIndex.ToString() & ". " & employeeName
 & _
        " (Employee Number " & keyValue.ToString()
 & _
        ") is protected."
    
    End If

  End Sub
   
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>FormViewDeleteEventArgs Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        onitemdeleting="EmployeeFormView_ItemDeleting"
  
        runat="server">
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>'
 
                  runat="server"/>
              </td>
              <td>
                <asp:label id="FirstNameLabel"
                  text='<%#Bind("FirstName")%>'
                  font-bold="true"
                  runat="server"/>
                <asp:label id="LastNameLabel"
                  text='<%#Bind("LastName")%>'
                  font-bold="true"
                  runat="server"/>
                <br/>     
                <asp:label id="TitleLabel"
                  text='<%#Bind("Title")%>'
                  runat="server"/>        
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:button id="DeleteButton"
                  text="Delete Record"
                  commandname="Delete"
                  runat="server" />
              </td>
            </tr>
          </table>
        
        </itemtemplate>         
                  
      </asp:formview>
      
      <asp:label id="MessageLabel"
        forecolor="Red"
        runat="server"/>
          
      <!-- This example uses Microsoft SQL Server and connects
  -->
      <!-- to the Northwind sample database. Use an ASP.NET
     -->
      <!-- expression to retrieve the connection string
 value   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName],
 [Title], [PhotoPath] From [Employees]"
        deletecommand="Delete [Employees] Where [EmployeeID]=@EmployeeID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
            
    </form>
  </body>
</html>

<%@ Page language="C#" %>

<script runat="server">

  void EmployeeFormView_ItemDeleting(Object sender, FormViewDeleteEventArgs
 e)
  {
    // Get the employee ID, name, and job title from the Keys and Values
    // properties.
    String keyValue = e.Keys["EmployeeID"].ToString();
    String employeeName = e.Values["FirstName"].ToString() +
      " " + e.Values["LastName"].ToString();
    String title = e.Values["Title"].ToString();

    // Cancel the delete operation if the user attempts to 
    // delete a protected record. In this example, records for
    // employees with a "Sales Manager" job title are protected.
    if (title.Equals("Sales Manager"))
    {
      e.Cancel = true;
      MessageLabel.Text = "You cannot delete record " +
        e.RowIndex.ToString() + ". " + employeeName +
        " (Employee Number " + keyValue.ToString() +
        ") is protected.";
    }

  }
   
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>FormViewDeleteEventArgs Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID"
        onitemdeleting="EmployeeFormView_ItemDeleting"  
        runat="server">
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <asp:label id="FirstNameLabel"
                  text='<%#Bind("FirstName")%>'
                  font-bold="true"
                  runat="server"/>
                <asp:label id="LastNameLabel"
                  text='<%#Bind("LastName")%>'
                  font-bold="true"
                  runat="server"/>
                <br/>     
                <asp:label id="TitleLabel"
                  text='<%#Bind("Title")%>'
                  runat="server"/>        
              </td>
            </tr>
            <tr>
              <td colspan="2">
                <asp:button id="DeleteButton"
                  text="Delete Record"
                  commandname="Delete"
                  runat="server" />
              </td>
            </tr>
          </table>
        
        </itemtemplate>         
                  
      </asp:formview>
      
      <asp:label id="MessageLabel"
        forecolor="Red"
        runat="server"/>
          
      <!-- This example uses Microsoft SQL Server and connects  -->
      <!-- to the Northwind sample database. Use an ASP.NET     -->
      <!-- expression to retrieve the connection string value
   -->
      <!-- from the Web.config file.                            -->
      <asp:sqldatasource id="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title],
 [PhotoPath] From [Employees]"
        deletecommand="Delete [Employees] Where [EmployeeID]=@EmployeeID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
 
        runat="server"/>
            
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
FormViewDeleteEventArgs クラス
FormViewDeleteEventArgs メンバ
System.Web.UI.WebControls 名前空間
FormView クラス
FormViewDeleteEventHandler
System.Collections.Specialized.IOrderedDictionary
System.Collections.Specialized.OrderedDictionary
System.Collections.DictionaryEntry
FormViewDeleteEventArgs.Keys プロパティ


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS