I am stuck in a situation where I need to disable a few columns in each row, except for the newly added row.
That is, I have 10 columns in the grid and the first 3 columns are databound and come from the database as disabled or read-only. The rest are editable.
If I add a new row, then all the columns of the new row must be enabled until it is saved.
I don’t have any DataKey or primary key for my existing row or the new row. I have to check for some boolean value like IsNewRow.
In my current scenario I am using this code block:
Private Sub dgTimeSheet_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles dgTimeSheet.InitializeRow
''if either column key is Project, Class or Milestone
'' Activation.NoEdit = Disable and Activation.AllowEdit = Enable
Dim index As Integer = e.Row.Index
If e.Row.IsAddRow Then
dgTimeSheet.Rows(index).Cells(PROJECT).Activation = Activation.AllowEdit
dgTimeSheet.Rows(index).Cells(SERVICE_ISSUE_CLASS).Activation = Activation.AllowEdit
dgTimeSheet.Rows(index).Cells(MILESTONE).Activation = Activation.AllowEdit
Else
dgTimeSheet.Rows(index).Cells(PROJECT).Activation = Activation.NoEdit
dgTimeSheet.Rows(index).Cells(SERVICE_ISSUE_CLASS).Activation = Activation.NoEdit
dgTimeSheet.Rows(index).Cells(MILESTONE).Activation = Activation.NoEdit
End If
CheckRows()
End Sub
The problem is that if I click on disabled/read-only rows, then newly added rows also get disabled, which I don’t want.
I am fighting with a similar problem in C#, so this is fishing in the dark… Is it possible, in your case, to add an IgnoreRowColActivation = true statement to keep the rows from reverting?