GrapeCity.Win.MultiRow Namespace > GcMultiRow Class : DataError Event |
<FeatureAttribute(Name="DataError", Version="v5.0")> <SRDescriptionAttribute("Occurs when an external data-parsing or validation operation throws an exception, or when an attempt to commit data to a data source does not succeed.")> <SRCategoryAttribute("Behavior")> Public Event DataError As EventHandler(Of DataErrorEventArgs)
Dim instance As GcMultiRow Dim handler As EventHandler(Of DataErrorEventArgs) AddHandler instance.DataError, handler
[Feature(Name="DataError", Version="v5.0")] [SRDescription("Occurs when an external data-parsing or validation operation throws an exception, or when an attempt to commit data to a data source does not succeed.")] [SRCategory("Behavior")] public event EventHandler<DataErrorEventArgs> DataError
The event handler receives an argument of type DataErrorEventArgs containing data related to this event. The following DataErrorEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Cancel | (Inherited from System.ComponentModel.CancelEventArgs) |
CellIndex | Gets the cell index in its parent Section. (Inherited from GrapeCity.Win.MultiRow.CellCancelEventArgs) |
CellName | Gets the cell name. (Inherited from GrapeCity.Win.MultiRow.CellCancelEventArgs) |
Context | Gets the context of this data error. |
Exception | Gets the thrown exception that caused the data error. |
RowIndex | Gets the index of the owner Row that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellCancelEventArgs) |
Scope | Gets the cell area that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellCancelEventArgs) |
SectionIndex | Gets the index of the owner Section that the event occurs for. (Inherited from GrapeCity.Win.MultiRow.CellCancelEventArgs) |
ThrowException | Gets a value that indicates whether to throw an exception. |
void gcMultiRow1_DataError(object sender, DataErrorEventArgs e) { // The first id cell can only input numbers, if user inputs an invalid value, DataError event is fired. // You should handle this event to handle some error cases. if ((e.Context & DataErrorContexts.Commit) != 0) { // When committing value occurs error, show a message box to notify user, and roll back value. MessageBox.Show(e.Exception.Message); EditingActions.CancelEdit.Execute(this.gcMultiRow1); } else { // Other handle. } }
Private Sub gcMultiRow1_DataError(ByVal sender As Object, ByVal e As DataErrorEventArgs) Handles gcMultiRow1.DataError ' The first id cell can only input numbers, if user inputs an invalid value, DataError event is fired. ' You should handle this event to handle some error cases. If (e.Context And DataErrorContexts.Commit) <> 0 Then ' When committing value occurs error, show a message box to notify user, and roll back value. MessageBox.Show(e.Exception.Message) EditingActions.CancelEdit.Execute(Me.gcMultiRow1) ' Other handle. Else End If End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2