Relative Content

Tag Archive for model-view-controllerc#-4.0data-bindingentity-framework-core

Error when binding data with data grid : Unable to cast object of type ‘System.Int32’ to type ‘System.String’

Setting up my Projets.cs table for binding with a data grid. I got that error Unable to cast object of type 'System.Int32' to type 'System.String'. . I Tried adding converters to the code. The primary key and foreign keys defined in the model are the issue. Thing is I don’t want them to be visible in the data grid but instead I get the attributes defined in those models each by its foreign key defined in this the Projet table. Is this possible ? I been stuck for days because I am forced to use MVC instead of MVVM in a desktop app. So i would appreciate any help as this is my last resort.
Here is my Projets.cs Code :