1
In my Return View(), is there a way for me to return two or more lists? These lists are the result of a.
1
In my Return View(), is there a way for me to return two or more lists? These lists are the result of a.
0
You can put in Viewbag
ViewBag.Lista1 = new List<>();
ViewBag.Lista2 = new List<>();
return View();
Then the View Voce accesses in the same way:
@ViewBag.Lista1
Now Voce can if you want, create a class c# Viewmodel that is "wrapper" by joining the two lists in a new class
return View(new MyViewModel{ Lista1 = new List<>(), Lista2 = new List<>() });
Then the View Voce accesses:
@Model.Lista1
Sack ?
I saw this example net and am now seeing how to do to meet my need
Browser other questions tagged c# asp.net-mvc asp.net-mvc-5 linq
You are not signed in. Login or sign up in order to post.
Yes @pnet. You can return as Viewbag or as Viewdata, then just go through the view ;)
– CesarMiguel
There are differences between them, like performance, "easier to work", more elegant, anyway, there is difference? When to use one or the other?
– pnet
Both are accessible to work, now in performance I can not tell you which is the best. But I believe that there is not much difference
– CesarMiguel