I'm using C# VS2010 Entity Framework sql Server.
I have a very (read-only) simple app to show and filter work orders by project and discipline. It uses EF to populate the controls. Using the wizard, I changed the Foreign Key reference column "DisciplineID" (int) to a ComboBox column. When I changed it using the wizard, I populated the box using the EF datasource for the Discipline table (tblDiscipline) to simply display the Discipline (Plumbing, Electrical, etc.) instead of the integer foreign key. Here's the wizard image:
When I leave the ProjectID column as a text box control, it works fine, showing the integer Discipline ID. When I change it as shown, I get the following
"System.ArgumentException: DataGridViewComboBoxCell value is not valid"
.
The DisciplineID can be null. Is that the issue? How do I deal with it? Or is something else wrong. This is a production db, so referential integrity guarantees no invalid keys, though null is allowed...
Ideas?