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

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

DetailsViewInsertedEventArgs.ExceptionHandled プロパティ

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

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

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

Public Property ExceptionHandled As
 Boolean
Dim instance As DetailsViewInsertedEventArgs
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" autoeventwireup="false"
 %>

<script runat="server">

  Sub CustomerDetailsView_ItemInserted(ByVal
 sender As Object, _
    ByVal e As DetailsViewInsertedEventArgs)
 _
    Handles CustomerDetailsView.ItemInserted

    ' Use the Exception property to determine whether an exception
    ' occurred during the insert operation.
    If e.Exception Is Nothing
 And e.AffectedRows = 1 Then
    
      ' Use the Values property to get the value entered by 
      ' the user for the CompanyName field.
      Dim name As String
 = e.Values("CompanyName").ToString()

      ' Display a confirmation message.
      MessageLabel.Text = name & " added successfully. "
    
    Else
    
      ' Insert the code to handle the exception.
      MessageLabel.Text = e.Exception.Message
      
      ' Use the ExceptionHandled property to indicate that the 
      ' exception is already handled.
      e.ExceptionHandled = True
      
      ' When an exception occurs, keep the DetailsView
      ' control in insert mode.
      e.KeepInInsertMode = True
    
    End If
        
  End Sub

</script>

<html>
  <body>
    <form runat="server">
        
      <h3>DetailsViewInsertedEventArgs Example</h3>
                
        <asp:detailsview id="CustomerDetailsView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogenerateinsertbutton="true"  
          autogeneraterows="true"
          allowpaging="true"
          runat="server">
               
          <fieldheaderstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <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="DetailsViewSource"
          selectcommand="Select [CustomerID], [CompanyName], [Address], 
            [City], [PostalCode], [Country] From [Customers]"
          insertcommand="INSERT INTO [Customers]([CustomerID], [CompanyName],
 
            [Address], [City], [PostalCode], [Country]) 
            VALUES (@CustomerID, @CompanyName, @Address, @City, 
            @PostalCode, @Country)"
          connectionstring=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
 
          runat="server"/>
            
      </form>
  </body>
</html>

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

<script runat="server">

  void CustomerDetailsView_ItemInserted(Object sender, 
    DetailsViewInsertedEventArgs e)
  {
    // Use the Exception property to determine whether an exception
    // occurred during the insert operation.
    if (e.Exception == null && e.AffectedRows
 == 1)
    {
      // Use the Values property to get the value entered by 
      // the user for the CompanyName field.
      String name = e.Values["CompanyName"].ToString();

      // Display a confirmation message.
      MessageLabel.Text = name + " added successfully. ";

    }
    else
    {
      // Insert the code to handle the exception.
      MessageLabel.Text = e.Exception.Message;
      
      // Use the ExceptionHandled property to indicate that the 
      // exception is already handled.
      e.ExceptionHandled = true;
      
      // When an exception occurs, keep the DetailsView
      // control in insert mode.
      e.KeepInInsertMode = true;
    }
  }

</script>

<html>
  <body>
    <form runat="server">
        
      <h3>DetailsViewInsertedEventArgs Example</h3>
                
        <asp:detailsview id="CustomerDetailsView"
          datasourceid="DetailsViewSource"
          datakeynames="CustomerID"
          autogenerateinsertbutton="true"  
          autogeneraterows="true"
          allowpaging="true"
          oniteminserted="CustomerDetailsView_ItemInserted" 
          runat="server">
               
          <fieldheaderstyle backcolor="Navy"
            forecolor="White"/>
                    
        </asp:detailsview>
        
        <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="DetailsViewSource"
          selectcommand="Select [CustomerID], [CompanyName], [Address], 
            [City], [PostalCode], [Country] From [Customers]"
          insertcommand="INSERT INTO [Customers]([CustomerID], 
            [CompanyName], [Address], [City], [PostalCode], 
            [Country]) VALUES (@CustomerID, @CompanyName, @Address, 
            @City, @PostalCode, @Country)"
          connectionstring=
            "<%$ ConnectionStrings:NorthWindConnectionString%>" 
          runat="server"/>
            
      </form>
  </body>
</html>

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


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS