This question is locked. New answers and comments are not allowed.
Here's my grid
Class year > Course > Student
Problem 1. How can I get the key from the first grid? (classyearID from classyear grid?)
The reason I need it because I have more than 5 class years, but only have 2 courses. so basically those two coursse will exist in every class year. and since I cant get the class yearID, students are reappearing on each class year, please help
check my view below:
@(Html.Telerik().Grid<ClassYear>().HtmlAttributes(new { style = "width: 100%" })
.Name("grdClassYear")
.DataBinding(binding => binding.Ajax()
.Select("GetClassYears", "Home"))
.DataKeys(keys => keys
.Add(o => o.ClassYearID)
.RouteKey("classyearID"))
.Columns(cols =>
{
cols.Bound(c => c.ClassYearDate);
cols.Bound(c => c.Name);
})
.DetailView(course => course.ClientTemplate(
Html.Telerik().Grid<Course>()
.Name("grdCourse_<#= ClassYearID #>")
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("GetCourses", "Home"))
.DataKeys(keys => keys.Add(o => o.CourseID))
.Columns(cols =>
{
cols.Bound(c => c.CourseName);
cols.Bound(c => c.Description);
})
.DetailView(stu => stu.ClientTemplate(
Html.Telerik().Grid<Student>()
.Name("grdStudent_<#= CourseID #>")
.DataBinding(dataBinding => dataBinding.Ajax()
.Select("GetStudentsA", "Home", new { classyearID = "<#= ClassYearID #>", courseID = "<#= CourseID #>" })))
.DataKeys(keys => keys.Add(o => o.PersonID))
.Columns(cols =>
{
cols.Bound(c => c.PersonID).ReadOnly().Hidden();
cols.Bound(c => c.MidshipmenNumber);
cols.Bound(c => c.LastName);
cols.Bound(c => c.FirstName);
})
.Sortable()
.ToHtmlString()
))