Update datasource from unbound datagridview
Posted on 2008-11-04
I have a DataGridView (RadGridView) that I fill with data from several datatables (SQL datasource). All the data displayed is unbound.
After a user made changes in the GridView I need to update the unbound datatable. My approach is to use the unique "ProductID" shown in the GridView to find the corresponding DataRow in the DataTable and for instance update the "status" of this DataRow.
I am not able to create the code that uses the "ProductID" from the GridView to update the DataRow in the DataTable with the corresponding "ProductID".
Help is appreciated.
Dim MatchingRows() As DataRow = Nothing
MatchingRows = MainForm.DS.Tables("Products").Select("ProductNumber=" & Me.rgvProducts.CurrentRow.Cells("ProductNumber").Value)
Dim ProductID As Integer = CInt(MatchingRows(0).Item("ProductID"))
MainForm.DS.Tables("Products").Rows(ProductID).Item("Status") = 40 'THIS DOES NOT WORK