I got this problem. I have a DataGridView
with a DataSource
that is a Linq query, and when I show the data from my database in the DataGridView
, I can't edit anything.
What's the problem?
Here's my code.
private void btMau_Click(object sender, EventArgs e)
{
var lst = from list in db.Maus
join dt in db.DiaTangs on list.IDDiaTang equals dt.IDDiaTang
select new
{
list.IDMau,
list.IDHoKhoan,
list.Lop,
list.BeDayMau,
list.DoSauMau,
dt.TenDiaTang,
dt.MoTa
};
dgv.DataSource = lst;
dgv.ContextMenuStrip = contextMenuStrip2;
check = "Mau";
}
Sorry for my bad english!
PS: dgv
is DataGridView
currently your variable is read only. You can fix it by
For more details and example, please see this page