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

6 leves of detail in a master/detail grid

2 Answers 102 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.
David
Top achievements
Rank 1
David asked on 27 Apr 2012, 10:50 AM
I have that class:

public partial class Genre
{
    public int GenreId { get; set; }
    public string Name { get; set; }
    public List<Genre> Childs { get; set; }
}


I have a list where every Genre have 6 child. every child can have 6 child. I need a grid where I can examine all the childs in every Genre. I have been looking the example of the Master/detail>server hierarchy in the grid examples but I need more levels of detail. How could I write the View to specify until 6 levels of detail?? Thank you very much.

2 Answers, 1 is accepted

Sort by
0
Heimo Hammer
Top achievements
Rank 1
answered on 27 Apr 2012, 12:13 PM
Check the demos - http://demos.telerik.com/aspnet-mvc/grid/hierarchyajax 
it depends what binding you are using , but if your problem is the nested @<text></text> tags - to avoid this you should use different overload of the Template (ClientTemplate) methods (easiest is to use the string overload and call the ToHtmlString() after each component you pass to the Template method).
0
David
Top achievements
Rank 1
answered on 27 Apr 2012, 03:18 PM
thank you for answering.

I have tried that:

@using BptMainGrid.Models;
 
@model IEnumerable<Genre>
  
@{Html.Telerik().Grid<Genre>()
    .Name("Genres")
    .Columns(columns =>
    {
        columns.Bound(e => e.GenreId).Width(200);
        columns.Bound(e => e.Name).Width(200);
    })
    .DetailView(detailView => detailView.ClientTemplate(
            Html.Telerik().Grid<Genre>()
            .Name("Secondlevel")
            .Columns(columns =>
            {
                columns.Bound(o => o.GenreId).Width(200);
                columns.Bound(o => o.Name).Width(200);
            })
            .DetailView(detailView2 => detailView2.ClientTemplate(
                    Html.Telerik().Grid<Genre>()
                    .Name("Thirdlevel")
                    .Columns(columns =>
                    {
                        columns.Bound(oo => oo.GenreId).Width(200);
                        columns.Bound(oo => oo.Name).Width(200);
                    })
                    .Pageable()
                    .Sortable()
                    .ToHtmlString()
                ))
                .Pageable()
                .Sortable()
                .Filterable()
                .ToHtmlString()
        ))
    .Pageable(paging => paging.PageSize(5))
    .Sortable()
    .Render();
    }

and nothing is showed. I can see the grid but that's empty. I don't understand that because with <text> the data was showed. Thanks in advance.
Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Heimo Hammer
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or