Reputation: 133
I have a code similar to next to load a data from a SQL query.....
Dim myDataset as new dataset = myMethod(params) 'This is a methos that fills a common dataset.
With Me.myRadDataGrid
.AutoGenerateColumns = True
.ItemsSource = myDataset.Tables(0).Rows
End With
So far so good....but when I tried to remove a line the object items do not nothing; the line do not show any exception, but nothing happend...
Me.myRadDataGrid.Items.RemoveAt(myIndex) 'Nohitng happend
Me.myRadDataGrid.Items.Remove(Me.myRadDataGrid.SelectItem) 'Nothig happend
Me.myRadDataGrid.Items.Refresh()
Me.myRadDataGrid.Rebind()
At the end the dataset collection into a RadGridView has the same elements....do not remove any row.
Thanks to all....
Upvotes: 1
Views: 3282
Reputation: 132648
You need to remove the item from the ItemsSource
, not from the Items
collection.
So remove the item from myDataset.Tables(0).Rows
, and you'll probably need to refresh the grid manually since I'm fairly sure a DataTable
will not automatically raise a change notification like an ObservableCollection
does when an item gets removed.
Upvotes: 2