Making Infragistics ultrawingrid, desired columns readonly

Posted by Amit Ranjan on Stack Overflow See other posts from Stack Overflow or by Amit Ranjan
Published on 2010-05-20T15:09:26Z Indexed on 2010/05/20 15:10 UTC
Read the original article Hit count: 814

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about infragistics