Let's say I have a table like so:
Friend
------
Id int not null
FriendName nvarchar(50) not null
Phone nvarchar(50) null
If I bind my DataGridView
control in a Windows Forms application to an ObjectQuery<Friend>
/ObjectSet<Friend>
/IList<Friend>
returned from an ObjectContext
like so:
MyFriendsGridView.DataSource = _context.Friends.ToList();
All the columns that are in the Friend table appear in the grid. Suppose I want the Id column not to show up in the grid, how do I do that?
Do I simply hide the column in the grid's properties by setting the column's visibility to false? Is there a more elegant solution?