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
1706
Delete selected Row
posted

Hi,

I am trying to Delete a Row with the Delete Key from the KeyDown event.   I have the DeleteKeyAction set to Delete Selected Rows (but have tried all 4 options) and I have RowSelection set to single but also tried multiple. 

My problem is that the KeyDown event will only fire if I select a cell.  It does not fire when I just have a row selected.  I've included my grid loading and keydown event code.

 Private Sub idgQuotesDetail_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles idgQuotesDetail.Loaded
        Me.idgQuotesDetail.SelectionSettings.RowSelection = Infragistics.Silverlight.SelectionType.Single
        Me.idgQuotesDetail.SelectionSettings.CellSelection = Infragistics.Silverlight.SelectionType.Single
        Me.idgQuotesDetail.RowSelectorSettings.Visibility = Windows.Visibility.Visible
        Me.idgQuotesDetail.DeleteKeyAction = Infragistics.Silverlight.DeleteKeyAction.DeleteSelectedRows
        Me.idgQuotesDetail.EditingSettings.AllowEditing = Infragistics.Silverlight.EditingType.Cell
        Me.idgQuotesDetail.EditingSettings.IsMouseActionEditingEnabled = Infragistics.Silverlight.MouseEditingAction.SingleClick
        Me.idgQuotesDetail.PagerSettings.AllowPaging = Infragistics.Silverlight.PagingLocation.Bottom
        Me.idgQuotesDetail.PagerSettings.PageSize = 6
        Me.idgQuotesDetail.SortingSettings.AllowSorting = True
        Me.idgQuotesDetail.SortingSettings.AllowMultipleColumnSorting = True
    End Sub

    Private Sub idgQuotesDetail_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Input.KeyEventArgs) Handles idgQuotesDetail.KeyDown
        Select Case e.Key
            Case Key.Insert
                AddNewQuoteDetail()
            Case Key.Delete
                DeleteCurrentRow()
        End Select
    End Sub

Is this a bug or am I missing something?

Thanks,

Lisa.

 

Parents
No Data
Reply
  • 5595
    posted

    Hi,

    From the code you provided it seems like you are trying to delete the row on your own when the "Delete" key is pressed. However, when you set DeleteKeyAction, the Grid automatically removes the corresponding rows based on your DeleteKeyAction setting.

    Could you try if this will work for you?

    This might be related to the fact that the event is not firing, but we will look further in that, it might be an issue.

     

    HTH,

Children