This is a migrated thread and some comments may be shown as answers.

[Solved] MVC grid not getting nested right

0 Answers 33 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brent
Top achievements
Rank 1
Brent asked on 10 Dec 2012, 04:10 PM
Hello, 
I have a nested grid view in my mvc 4 site and it works but it is not being nested in the grid. Basically i have a list of employees and and using the hierarchical grid to show information about the employee so for example I have


-------------------------------------------------
Brent Morrison
-------------------------------------------------
V-----------------------
information
information
-----------------------

and when you click the arrow to show this info  the information block if over the next 2 employee names.
I will include a picture and the view so you all can look at it.

Brent

@model IEnumerable<SpectrumData.SpectrumTS.Employee>
 
@{
    ViewBag.Title = "EmployeeList";
}
 
<h2>EmployeeList</h2>
 
 
<p>
    @Html.ActionLink("Create New", "CreateEmployee")
</p>
    @{ Html.Telerik().Grid(Model)
    .Name("Employees")
    .Columns(columns =>
    {
        columns.Bound(e => e.FullName).Width(140);
        columns.Bound(e => e.Email).Width(140);
        columns.Template(e=>Html.ActionLink("Edit Employee", "EditEmployee", new { id=e.EmployeeId }));
        columns.Template(e => Html.ActionLink("Edit Time Approver", "EditTimeApprover", new { id = e.EmployeeId }));
        columns.Template(e => Html.ActionLink("View Employee", "ViewEmployee", new { id = e.EmployeeId }));
        columns.Template(e => Html.ActionLink("Delete Employee", "DeleteEmployee", new { id = e.EmployeeId }));
         
    })
    .DetailView(detailView => detailView.Template(
        @<text>
            @*
                The nested grid in the Detail View template
                is defined as an expression - @(...).
                 
                If we were to use a code block with Render() instead,
                the nested grids would be output outside of the parent grid.
            *@
            @(Html.Telerik().Grid(item.TimeApprovers.ListOfApproversForEmployee)
                    .Name("Orders")
                    .Columns(columns =>
                    {
                        columns.Bound(o => o.FullName).Title("Approvers");
 
                    })
 
 
 
                    .Sortable()
                     
            )
        </text>
    ))
     
    
    .Sortable()
    .Render();
}
Tags
Grid
Asked by
Brent
Top achievements
Rank 1
Share this question
or