views:

124

answers:

1

I am stucked at the situation where I need to disable few columns of a each row ,except newly added row.

That is I have 10 columns in grid and I want first three columns that are binded from the rows coming from db as disabled or read-only, rest are editable. if I add new row then all columns of new row must be enabled until and unless it is saved.

I dont have any DataKey or Primary key for my existing row or new row. I have to check for some boolean values 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

but the problem is that if i click on disabled/readonly rows then newly added rows also gets disabled., which i dont want

A: 

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?

Van