A
AC
I have a datatable that contains data I'm inserting programatically (not from a datasource... using between postbacks to persist data). I need to be able to update the elements within the table, but I also need to sort the elements using a DataView. Here's my code as it stands:
Dim dv As DataView = New DataView(Me._selectedQuickLinks, String.Empty, "SortOrder ASC", DataViewRowState.CurrentRows)
dv.AllowEdit = True
' step through all rows and update the sort order to whole numbers
For Each row As DataRowView In dv
row.BeginEdit()
row("SortOrder") = i
row.EndEdit()
i += 1
Next
Me._selectedQuickLinks.AcceptChanges()
However my table isn't getting the updated values... (by default they started with 999, and when I write it out, they are always 999).
Dim dv As DataView = New DataView(Me._selectedQuickLinks, String.Empty, "SortOrder ASC", DataViewRowState.CurrentRows)
dv.AllowEdit = True
' step through all rows and update the sort order to whole numbers
For Each row As DataRowView In dv
row.BeginEdit()
row("SortOrder") = i
row.EndEdit()
i += 1
Next
Me._selectedQuickLinks.AcceptChanges()
However my table isn't getting the updated values... (by default they started with 999, and when I write it out, they are always 999).