MVC Viewbag显示System.Data.Entity.DynamicProxies

时间:2015-06-02 08:30:47

标签: asp.net-mvc-4

我想在View中显示我的Viewbag.studentFaculty

但是当我写@Viewbag.studentFaculty

我得到了像这样的值 System.Data.Entity.DynamicProxies.Faculty_D453027D6C8963B9EE27305AED88670DD8233614

我的代码

int FGD = db.Students.Where(stu => stu.StudentID == id).Select(f => f.Student_FGD_FK).FirstOrDefault();
Faculty stufac= db.FacultyGovermentDepartments.Where(f => f.FGD_ID == FGD).Select(fac => fac.Faculty).FirstOrDefault();
ViewBag.StudentFaculty = stufac;

1 个答案:

答案 0 :(得分:1)

您可以将其存储在变量中:

@ProductName