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

DetailView Template not working

2 Answers 35 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.
Bao Hoang
Top achievements
Rank 1
Bao Hoang asked on 28 May 2012, 01:49 PM

 
@(Html.Telerik().Grid(Model)
    .Name("Grid")
    .Columns(column =>
        {
            column.Bound(a => a.Date).Title("Skapat").Format("{0:yyyy/MM/dd}");
            column.Bound(a => a.Code).Title("Nr").Width(100);
            column.Bound(a => a.Caption).Title("Ärenden");
            column.Bound(a => a.CreatorCaption).Title("Anmälaren");
        })
     .DetailView(detailView => detailView.Template(e =>
                {
                    Html.Telerik().TabStrip()
                        .Name("TabStrip")
                        .SelectedIndex(0)
                        .Items(items =>
                        {
                            items.Add().Text("Ärenden").Content(@e.Caption);
                            items.Add().Text("Anmälare").Content(@e.CreatorCaption);
                            items.Add().Text("Skapat").Content(@e.Date.ToString());
                        })
                        .Render();
                }
     ))
    .RowAction(row =>
     {
         if (row.Index == 0)
       {
             row.DetailRow.Expanded = true;
         }
     })
    .Sortable()
    .Pageable(pager =>
            {
                pager.Style(GridPagerStyles.NextPreviousAndDropDown | GridPagerStyles.Numeric);
                //pager.Style(GridPagerStyles.PageInput);
            })
)
Hi,
 
I have followed the demo http://demos.telerik.com/aspnet-mvc/razor/grid/detailsserverside?theme=windows7
to construct my grid with detail view but its not really working for me.
  
The detail view is not in the grid but outside and It shows only the first row when I clicked on the tabs.
 
Here is my code . I attached also the result I got as a picture.
Thanks
Bao Hoang

2 Answers, 1 is accepted

Sort by
0
Bao Hoang
Top achievements
Rank 1
answered on 28 May 2012, 03:48 PM
Problem solved but there is a minor left . 

As in the code I have 1 master row and 1 detail row which contains 3 tabs. I dont know why but only the first detail row that I can see the data in all the tabs. 
When I click on the other detail rows' tabs. It doesnt happen anything. 
Regards
0
Mike
Top achievements
Rank 1
answered on 10 Jul 2012, 02:27 PM
Your problem is you are calling render and should be calling ToHtmlString() instead.
Tags
Grid
Asked by
Bao Hoang
Top achievements
Rank 1
Answers by
Bao Hoang
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Share this question
or