【发布时间】:2012-10-16 19:24:27
【问题描述】:
我有一个类似于 next 的代码来从 SQL 查询中加载数据.....
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
到目前为止一切都很好....但是当我尝试删除一行时,对象项并没有什么作用;该行没有显示任何异常,但什么也没发生...
Me.myRadDataGrid.Items.RemoveAt(myIndex) 'Nohitng happend
Me.myRadDataGrid.Items.Remove(Me.myRadDataGrid.SelectItem) 'Nothig happend
Me.myRadDataGrid.Items.Refresh()
Me.myRadDataGrid.Rebind()
最后,RadGridView 中的数据集集合具有相同的元素....不要删除任何行。
谢谢大家....
【问题讨论】:
-
您需要从
ItemsSource中删除该项目,而不是从Items集合中。因此,从myDataset.Tables(0).Rows中删除该项目,您可能需要手动刷新网格,因为我认为它不会自动引发更改通知。 -
谢谢@Rachel,这很好用!!!
-
我将我的评论复制到一个答案中,以便您接受它:)
标签: wpf telerik row telerik-grid radgridview