下面我有顯示所有Kendo Grid員工的代碼。現在在這個例子中,假設我想在每個員工行下方的詳細網格中顯示員工的家人姓名和年齡。我怎樣才能做到這一點?我嘗試在Telerik網站上查找,但我無法理解。請指教。謝謝。Telerik Kendo MVC 5主細節網格
型號
public class Emp
{
public int EmpID{ get; set; }
public string FirstName{ get; set; }
public string LastName { get; set; }
}
public class EmpFamily
{
public int EmpID{ get; set; }
public string Name{ get; set; }
public int Age { get; set; }
}
控制器
public ActionResult Index(string SearchString)
{
var EmpRows = from S in db.Emp
select S;
List<EmpRec> EmpList = new List<EmpRec>();
foreach (Disk EmpRow in EmpRows)
{
EmpRec e = new EmpRec();
e.EmpID = EmpRow.EmpID;
e.FirstName = EmpRow.FirstName;
e.LastName = EmpRow.LastName ;
EmpList.Add(e);
}
return View(EmpList);
}
查看
@model IEnumerable<TestProj.Models.EmpRec>
@using (Html.BeginForm())
{
}
@(Html.Kendo().Grid(Model)
.Name("kGrid")
.Pageable()
.Columns(columns =>
{
columns.Bound(p => p.EmpID).Filterable(true).Title("ID");
columns.Bound(p => p.FirstName).Title("First Name");
columns.Bound(p => p.LastName).Title("Last Name ");
})
.Navigatable()
.DataSource(datasource => datasource
.Ajax()
.PageSize(15)
.ServerOperation(false)
)
)