I have a list of patients. One of the properties of the Patient class is PatientId, which is an int. My list is initialized as follows:
List<Patient> = new List<Patient>() { new Patient { PatientId = 1,
FirstName = "Jane",
LastName = "Doe"}};
When I access the PatientId in my view with something like:
@Html.DisplayForModel(modelItem => modelItem.PatientId) //Error
I get an error message:
Cannot convert lambda expression to type 'object' because it is not a delegate type
source
share