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 code is like:
@{
ViewBag.Title = "KYC_Home";
}
@using UniBlue.Models;
@model UniBlue.Models.KYC
...
@foreach(KYC a in Model)
...
there will be an exception says:
CS1579: foreach statement cannot operate on variables of type 'UniBlue.Models.KYC' because 'UniBlue.Models.KYC' does not contain a public definition for 'GetEnumerator'
But, when i changed my code to @Model Page looks good but on the title it shows:
System.Collections.Generic.List`1[UniBlue.Models.KYC] UniBlue.Models.KYC
as regular HTML text
Can anybody tell me why this happened? What should I do to remove the strange title line?
See Question&Answers more detail:os