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

Dim instance As GridViewDeletedEventArgs Dim value As Boolean value = instance.ExceptionHandled instance.ExceptionHandled = 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 プロパティを使用して、イベント ハンドラで例外が処理されたかどうかを示します。このプロパティが true に設定されている場合、例外は処理されたと見なされ、再度スローされません。このプロパティが false に設定されている場合は、GridView コントロールによって例外が再度スローされます。どの例外が発生したかを確認するには、Exception プロパティを使用します。

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>

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


Weblioに収録されているすべての辞書からGridViewDeletedEventArgs.ExceptionHandled プロパティを検索する場合は、下記のリンクをクリックしてください。

- GridViewDeletedEventArgs.ExceptionHandled プロパティのページへのリンク