Binding Linq To Entities query results to a datagridview
Posted
by Nickson
on Stack Overflow
See other posts from Stack Overflow
or by Nickson
Published on 2010-03-17T07:54:56Z
Indexed on
2010/03/17
8:01 UTC
Read the original article
Hit count: 363
linq-to-entities
I just started playing with Linq to entities in a windows forms application and am not understanding one behavior that looks so simple though.
If i type code below, i get ReadOnly records in my dataGridView Dim x = From n in Table1 _ Select n.FirstName, n.LastName, N.Department DataGridView1.DataSource = x
But if i type the following code, i get editable rows in my dataGridView
Dim x = From n in Table1 _ Select n DataGridView1.DataSource = x
So, basically if i specify the column names to select and databind to my DataGridView1, the rows are readonly but if i do not specify the column names and databind to the DataGridView, the rows are editable and i don't understand why.
© Stack Overflow or respective owner