I have a DataGridView being populated using CoolStorage (ORM) CSList class as its DataSource. It is displaying Contacts and it’s the ContactType column that instead of displaying the underlying ContactTypeName just displays “ContactType” for every record.
I cannot change the value of that cell by stepping through the rows as it’s data bound, although when hovering over DataSource I can see that it has the ContactTypeName is available as a property of ContactType.
Is there a way I can change what value is displayed in the ContactType cells (I’m thinking something like an equivalent to ComboBox’s DisplayMember) without having to manually constuct a DataTable from my result set?
Many thanks.
The onlyOne way I know of to do it without setting up columns manually is to override theToString()function of theContactTypeclass.If you want to edit it, however, you’ll need to set up the columns manually.
Just about every other grid UI I’ve worked on needed to have the colums set up manually for one reason or another.
Another alternative is to bind to a wrapper class (basically a ViewModel) that exposes the ContactName as a property rather than as a related object. You could even do two-way binding with that model.