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
615
Deleting Rows in Code
posted

Hi All:

   I am trying to delete rows from an UltraDataSource via code, but the underlying DataTable's row doesn't get deleted, because  the UltraDataSource1_RowDeleting event never gets fired.  Here's my code:

        Dim uRow As UltraDataRow

           For Each uRow In UltraDataSource1.Rows
                If uRow("DateOfBirth") Is DBNull.Value AndAlso (uRow("Age") Is DBNull.Value OrElse DirectCast(uRow("Age"), Integer) = 0) Then
                    UltraDataSource1.Rows.Remove(uRow)
                End If
            Next

     The row gets removed from the UltraDataSource (and hence the UltraGrid, but it NEVER gets deleted from the dtCensus DataTable, because this event is not firing:

 

    Private Sub UltraDataSource1_RowDeleting(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinDataSource.RowDeletingEventArgs) Handles UltraDataSource1.RowDeleting
        ' RowDeleting is fired when a bound control tries to delete a row. Here
        ' you delete the associated row from the external data structure.
        dtCensus.Rows.RemoveAt(e.Row.Index)
    End Sub

     Can anyone help?  So far I have come up empty with tech support.

Kevin