Hi,
When I click the "Click here to add a new row" text on a grid, the new row is overlaid on the text and I insert values in place. The RowIndex of the new row is -1, and this allows me to differentiate between an insert and an edit,
If I call Rows.AddNew though it looks like the row is inserted and then edited, which means it is assigned a RowIndex and I can't now check whether this is an insert or update.
In the BeginEdit event, I check the RowIndex to determine whether we are inserting or editing as some of the columns are Insert Only as :
Dim rowindex As Integer = e.RowIndex
If rowindex > -1 Then
If CustomCheckForInsertOnly Then
e.Cancel = True
Exit Sub
End If
End If
This works fine for a click initiated insert, but doesn't for a programmatic insert as the RowIndex is now assigned.
Is there a way to simulate the "Click here to add a new row" behaviour when calling Rows.AddNew, or alternatively another way to differentiate between an insert and an update in BeginEdit?
Thanks,
Mark.
When I click the "Click here to add a new row" text on a grid, the new row is overlaid on the text and I insert values in place. The RowIndex of the new row is -1, and this allows me to differentiate between an insert and an edit,
If I call Rows.AddNew though it looks like the row is inserted and then edited, which means it is assigned a RowIndex and I can't now check whether this is an insert or update.
In the BeginEdit event, I check the RowIndex to determine whether we are inserting or editing as some of the columns are Insert Only as :
Dim rowindex As Integer = e.RowIndex
If rowindex > -1 Then
If CustomCheckForInsertOnly Then
e.Cancel = True
Exit Sub
End If
End If
This works fine for a click initiated insert, but doesn't for a programmatic insert as the RowIndex is now assigned.
Is there a way to simulate the "Click here to add a new row" behaviour when calling Rows.AddNew, or alternatively another way to differentiate between an insert and an update in BeginEdit?
Thanks,
Mark.