Row Deleting Issue

11 replies. Last post: April 29, 2015 10:18 AM by leo Chandra
Tags :
  • (None)
  • New Discussion
  • New Question
  • New Product Feedback
James MackinMember

Hello,

I have recently noticed that whenever I delete a row from my grid, the grid is not automatically refreshed, but the row is removed which causes the grid to confuse data and any subsequent rows deleted may delete an unintended row instead.

This can be replicated when the grid has 3 or more rows and any row above the bottom one is deleted. After one row is deleted, the rows below it will be incorrect and when called to be deleted will attempt to delete a row which was not intended. If the bottom row is deleted after any other, then it throws a NullReferenceException instead.

The code to initialize the grid and delete rows is as follows:


Private Sub Users_InitializeDataSource(sender As Object, e As ISNet.WebUI.WebGrid.DataSourceEventArgs) Handles Users.InitializeDataSource

        e.DataSource = DA.ExecuteDataView(CommandType.Text, "SELECT * FROM TestTable")

End Sub


Protected Sub Users_DeleteRow(sender As Object, e As ISNet.WebUI.WebGrid.RowEventArgs) Handles Users.DeleteRow

        Dim code As Byte = CByte(e.Row.KeyValue)

        DA.ExecuteNonQuery(CommandType.Text, String.Format("DELETE FROM TestTable WHERE Id = {0}", code))

End Sub

All times are GMT -5. The time now is 2:18 AM.
Previous Next