Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
3521
How to enter edit mode on a newly activated cell
posted

I have a requirement to make a grid used entirely for data entry.  Once the user tabs off the last cell of the last row, the grid needs to grow a new row where data entry can continue (they don't want an add row in the grid, they want the grid to take care of it).

I have been able to successfully add the row without a problem and I have been able to set the correct cell to be active.  However, I still have to click in the cell to continue the data edit and the users don't want to have to do this click action.  They want to just be able to keep on typing.  I will include the code snippet on how to add the blank row, but as I will point out by the screen shot, it doesn't take it all the way to entering edit mode.  Any ideas?

Private Sub CellExitedEditMode(sender As System.Object, e As Infragistics.Controls.Grids.ExitEditingCellEventArgs) Handles dgDataEntry.CellExitingEditMode

        Dim dgRow As Row = Nothing
        Dim dgRows As RowCollection = Nothing

        If Not e.Cell Is Nothing Then

            Select Case e.Cell.Column.Key.ToLower()

                Case "notes"

                    ' see if on the last row...
                    If e.Cell.Row.Index = Me.dgDataEntry.Rows.Count - 1 Then

                        dgRow = Me.dgDataEntry.Rows.CreateItem()

                        Me.dgDataEntry.Rows.Insert(e.Cell.Row.Index + 1, dgRow)

                        ' set the first cell in the newly added row to being edited
                        Me.dgDataEntry.Rows(Me.dgDataEntry.Rows.Count - 1).Cells(0).IsActive = True

                    Else

                       
                    End If

                Case Else

            End Select

        End If

    End Sub

 

Parents Reply Children
No Data