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

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

GridViewDeletedEventArgs.ExceptionHandled プロパティ

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

削除操作中に発生した例外イベント ハンドラ処理されたかどうかを示す値を取得または設定します

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

Public Property ExceptionHandled As
 Boolean
Dim instance As GridViewDeletedEventArgs
Dim value As Boolean

value = instance.ExceptionHandled

instance.ExceptionHandled = value
public bool ExceptionHandled { get;
 set; }
public:
property bool ExceptionHandled {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_ExceptionHandled ()

/** @property */
public void set_ExceptionHandled (boolean value)
public function get ExceptionHandled
 () : boolean

public function set ExceptionHandled
 (value : boolean)

プロパティ
イベント ハンドラ例外処理され場合trueそれ以外場合false既定値false です。

解説解説
使用例使用例

ExceptionHandled プロパティ使用して例外イベント ハンドラ処理されたことを示す方法の例を次に示します

<%@ Page language="VB" %>

<script runat="server">

  Sub CustomersGridView_RowDeleted(ByVal sender
 As Object, ByVal e As
 GridViewDeletedEventArgs)

    ' Use the Exception property to determine whether an exception
    ' occurred during the delete operation.
    If e.Exception Is Nothing
 Then

      ' Use the AffectedRows property to determine whether the
      ' record was deleted. Sometimes an error might occur that 
      ' does not raise an exception, but prevents the delete
      ' operation from completing.
      If e.AffectedRows = 1 Then
      
        Message.Text = "Record deleted successfully."
      
      Else
      
        Message.Text = "An error occurred during the delete operation."
      
      End If
    
    Else
          
      ' Insert the code to handle the exception.
      Message.Text = "An error occurred during the delete operation."

      ' Use the ExceptionHandled property to indicate that the 
      ' exception is already handled.
      e.ExceptionHandled = True
    
    End If
    
  End Sub
    
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>GridViewDeletedEventArgs Example</h3>
            
      <asp:label id="Message"
        forecolor="Red"          
        runat="server"/>
                
      <br/>
            
      <!-- The GridView control automatically sets the columns     -->
      <!-- specified in the datakeynames property
 as read-only.    -->
      <!-- No input controls are rendered for these columns
 in     -->
      <!-- edit mode.                                              -->
      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        autogeneratedeletebutton="true"
        datakeynames="CustomerID"
        onrowdeleted="CustomersGridView_RowDeleted"
  
        runat="server">
      </asp:gridview>
            
      <!-- 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="CustomersSqlDataSource"
  
        selectcommand="Select [CustomerID], [CompanyName], [Address],
 [City], [PostalCode], [Country] From [Customers]"
        deletecommand="Delete from Customers where CustomerID
 = @CustomerID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </asp:sqldatasource>
      
    </form>
  </body>
</html>

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

<script runat="server">

  void CustomersGridView_RowDeleted(Object sender, GridViewDeletedEventArgs
 e)
  {

    // Use the Exception property to determine whether an exception
    // occurred during the delete operation.
    if (e.Exception == null)
    {
      // Use the AffectedRows property to determine whether the
      // record was deleted. Sometimes an error might occur that 
      // does not raise an exception, but prevents the delete
      // operation from completing.
      if (e.AffectedRows == 1)
      {
        Message.Text = "Record deleted successfully.";
      }
      else
      {
        Message.Text = "An error occurred during the delete operation.";
      }
    }
    else
    {
      // Insert the code to handle the exception.
      Message.Text = "An error occurred during the delete operation.";

      // Use the ExceptionHandled property to indicate that the 
      // exception is already handled.
      e.ExceptionHandled = true;
    }
    
  }
    
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>GridViewDeletedEventArgs Example</h3>
            
      <asp:label id="Message"
        forecolor="Red"          
        runat="server"/>
                
      <br/>
            
      <!-- The GridView control automatically sets the columns     -->
      <!-- specified in the datakeynames property as read-only.
    -->
      <!-- No input controls are rendered for these columns
 in     -->
      <!-- edit mode.                                              -->
      <asp:gridview id="CustomersGridView" 
        datasourceid="CustomersSqlDataSource" 
        autogeneratecolumns="true"
        autogeneratedeletebutton="true"
        datakeynames="CustomerID"
        onrowdeleted="CustomersGridView_RowDeleted"  
        runat="server">
      </asp:gridview>
            
      <!-- 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="CustomersSqlDataSource"  
        selectcommand="Select [CustomerID], [CompanyName], [Address], [City],
 [PostalCode], [Country] From [Customers]"
        deletecommand="Delete from Customers where CustomerID = @CustomerID"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>"
        runat="server">
      </asp:sqldatasource>
      
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
GridViewDeletedEventArgs クラス
GridViewDeletedEventArgs メンバ
System.Web.UI.WebControls 名前空間
GridView クラス
GridViewDeletedEventHandler
GridView.RowDeleted イベント
GridViewDeletedEventArgs.AffectedRows プロパティ
GridViewDeletedEventArgs.Exception プロパティ


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS