【发布时间】:2014-02-05 08:40:21
【问题描述】:
在我的DataGridView 上,我已将 AllowUserToDeleteRows 设置为 True。
当我将DataGridView 的DataSource 设置为IQueryable 时
var dc = new Data.CustomersDataContext();
var q = dc.Customers;
dataGridView1.DataSource = q;
我可以从中删除行,但是当我将其设置为 List<T>
var dc = new Data.CustomersDataContext();
var l = dc.Customers.ToList();
dataGridView1.DataSource = l;
我不能再删除行(当我按下删除按钮时没有任何反应)
如何将我的DataSource 保留为List<T> 并且还能够删除行?
【问题讨论】:
-
客户是否有结构或类实例列表?
-
@Junaith 我不知道。这是 Linq-to-Sql 生成的。
-
@Junaith 我检查了我的 dbml 设计器,它是客户列表,其中客户是从 INotifyPropertyChanging、INotifyPropertyChanged 派生的类
标签: c# linq datagridview iqueryable