Basically I\'m doing a test caused by one of excpetion.
By using return View(list_a
) in controller I passed a list into my view, On my View page, the co
One is used to declare the strong type that the model is, and the other is used to access the model itself.
The following says that the strong type used for the model is UniBlue.Models.KYC
.
@model UniBlue.Models.KYC
This basically declares the 'variable' Model
as that type. It's akin to doing the following:
UniBlue.Models.KYC Model;
Model
is a variable, @model
is a keyword saying what type Model
will be.
Your error is because you've declared Model
as KYC, but KYC is not enumerable. You're using it in a foreach
expecting an IEnumerable<UniBlue.Models.KYC>
which is not the case.
If your model is truly a list, then use
@model IEnumerable<UniBlue.Models.KYC>
@model denotes the type of a variable you refer as @Model
@model string
@Model.ToUpper(); // works as @Model is of type string