GrapeCity MultiRow Windows Forms Documentation
CancelRowEdit Event
Example 


Occurs when the VirtualMode property of the GcMultiRow control is true and a row edit should be canceled.
Syntax
<SRCategoryAttribute("Action")>
<SRDescriptionAttribute("Occurs when the VirtualMode property of a GcMultiRow control is true and then cancels edits in a row. ")>
<FeatureAttribute(Name="VirtualMode", Version="v5.0")>
Public Event CancelRowEdit As EventHandler(Of QuestionEventArgs)
Dim instance As GcMultiRow
Dim handler As EventHandler(Of QuestionEventArgs)
 
AddHandler instance.CancelRowEdit, handler
[SRCategory("Action")]
[SRDescription("Occurs when the VirtualMode property of a GcMultiRow control is true and then cancels edits in a row. ")]
[Feature(Name="VirtualMode", Version="v5.0")]
public event EventHandler<QuestionEventArgs> CancelRowEdit
Event Data

The event handler receives an argument of type QuestionEventArgs containing data related to this event. The following QuestionEventArgs properties provide information specific to this event.

PropertyDescription
ResponseGets or sets a value indicating the response to a question represented by the event.  
Remarks
Changes are committed to the data cache at the cell level by default when the GcMultiRow control is in virtual mode. The CancelRowEdit event can be used when implementing row-level transactions.
Example
The following code example shows how to implement row level cancel when the MultiRow control is in virtual mode. This code example is part of a larger example provided for the VirtualMode property.
void gcMultiRow1_CancelRowEdit(object sender, QuestionEventArgs e)
        {
            int currentRowIndex = gcMultiRow1.CurrentCellPosition.RowIndex;
            // Cancel uncommitted new row.
            if (currentRowIndex >= 0 && currentRowIndex < gcMultiRow1.RowCount - 1)
            {
                // Cancel row level edit.
                userData[currentRowIndex] = new Student(restoreRow.ID, restoreRow.Name, restoreRow.MathematicsScore, restoreRow.PhilosophyScore);
            }
        }
Private Sub gcMultiRow1_CancelRowEdit(ByVal sender As Object, ByVal e As QuestionEventArgs) Handles gcMultiRow1.CancelRowEdit
        Dim currentRowIndex As Integer = gcMultiRow1.CurrentCellPosition.RowIndex
        ' Cancel uncommitted new row.
        If currentRowIndex >= 0 AndAlso currentRowIndex < gcMultiRow1.RowCount - 1 Then
            ' Cancel row level edit.
            userData(currentRowIndex) = New Student(restoreRow.ID, restoreRow.Name, restoreRow.MathematicsScore, restoreRow.PhilosophyScore)
        End If
    End Sub
Requirements

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

See Also

Reference

GcMultiRow Class
GcMultiRow Members
VirtualMode Property
CellValueNeeded Event
CellValuePushed Event
RowDirtyStateNeeded Event
NewRowNeeded Event

 

 


Copyright © GrapeCity, inc. All rights reserved.