In my controler I have the following;
public ActionResult contact()
{
truckTrax.Models.
truckTraxDataContext myTrax = new Models.truckTraxDataContext();
var x = from c in myTrax.contacts
join p in myTrax.phones on c.contactID equals p.contactId
join f in myTrax.phones on c.contactID equals f.contactId
join a in myTrax.addresses on c.contactID equals a.contactId
select new
{
c.firstName,
c.lastName,
c.middleName,
c.note,
a.address1,
a.address2,
a.City,
a.state,
a.postalCode,
}
;
return View((IQueryable)x);
}
The problem is how do I wire this up to the view? I have attempted multiple ways and as of yet can find no way to wire this to the view.
At present I have this which obviously is completely wrong but a bit of guidence would be greatly appreciated.
<%
@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Data.Linq.Table<x>>" %>
<%
@ Import Namespace="truckTrax" %>
<%
@ Import namespace="truckTrax.helpers" %>
<
asp:Content ID="EmployeeSubMenu" ContentPlaceHolderID="SubMenuHolder" runat="server">
<div class="subMenuPage">
<ul id="subMenu">
<li><%= Html.ActionLink("Employees", "Employees", "officemgt")%></li>
<li><%= Html.ActionLink("Drivers", "Drivers", "officemgt")%></li>
<li><%= Html.ActionLink("Accident Report", "accident", "officemgt")%></li>
<li><%= Html.ActionLink("Add New Employee", "addEmloyee", "officemgt")%></li>
</ul>
</div>
</
asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Employees</h2>
<%
= Html.Telerik().Grid(x)
.Name(
"Grid")
.Columns(columns =>
{
/* Column Bindings will go here */
})
.Sortable()
.Filterable()%>
<div id="pager"></div>
</asp:Content>
Thanks for any help that could be provided.