Controller action:
public ActionResult Index()
{
probaEntities proba = new probaEntities();
probaEntities proba1 = new probaEntities();
probaEntities proba2 = new probaEntities();
var query = from i in proba.name
from j in proba1.id_person
from k in proba2.last_name
select new
{
i.ime,
j.id,
k.prezime
};
return View(query);
}
View page:
<%@ Control Language="C#" Inherits="???" %>
<table>
<tr>
<th>
ime
</th>
<th>
broj
</th>
<th>
prezime
</th>
</tr>
<% foreach (var item in Model) { %>
<tr>
<td>
<%= Html.Encode(item.name) %>
</td>
<td>
<%= Html.Encode(item.id_person)%>
</td>
<td>
<%= Html.Encode(item.last_name)%>
</td>
</tr>
<% } %>
</table>
What to write in Inherits="???" ? This View is not strongly typed because I have post data to him from 3 tables. Do I have to make a special model for this view is there a shorter solution?