The error is pretty clear - your view declares the model to be
IEnumerable<ClassFeeVM>
, but you are trying to pass in a single
ClassFeeVM
instance.
Rewrite your code to properly create and populate the list of VMs and pass it to the model:
[HttpGet]
public PartialViewResult GetClassFee(int? Classid)
{
if (Classid == null) return NotFound();
List<ClassFee> classfees = db.ClassFees.Where(p => p.tblClass.ClassID == Classid).ToList();
List<ClassFeeVM> model = new List<ClassFeeVM>(classfees.Count);
foreach (var item in classfees)
{
model.Add(new ClassFeeVM
{
ClassFee = item.ClassFee1,
ClassID = item.ClassID,
ClassName = item.tblClass.ClassName,
FeeType = item.tblFeeType.FeeType,
});
}
return PartialView("_ClassFee", model);
}