I in the controller combined the two lists in this way

public ActionResult Device() { AD methodGetList = new AD(); ViewBag.Current = "Device"; ViewBag.Title = "Сеть"; var adList = methodGetList.GetListFromAD(); var deviceList = db.devices.ToList(); var all = from a in adList join d in deviceList on a.DisplayName equals d.DisplayName select new { a , d }; ViewBag.NewList = all.ToList(); return View(); } 

I looked in the debugger, everything seemed to be all right, but how can I put all this into view?

Try so

 @foreach (var items in ViewBag.NewList) { <tr> <td>@items.a.Organization</td> </tr> } 

But there is no data, without the same situation. Data that is

here's what it looks like in debugging enter image description here

    1 answer 1

    new { a , d } is a private class object for the assembly. A view that is in a separate assembly cannot see it - hence the problem.

    Do not use anonymous objects to transfer data from the view controller.