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

[Solved] DetailView template is rendering outside of the grid

2 Answers 95 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.
Ravindra
Top achievements
Rank 1
Ravindra asked on 26 Apr 2011, 04:47 AM
Hi,
we are using the telerik mvc grid (2011.1.315.340). trying to disply parent child hierarchical grid using the server binding.
when it is rendering, the detail view template is getting rendering outside of the grid (above the grid). Below is the code.
Html.Telerik().Grid(context.Data)
        .Name("Employees")
            .ClientEvents(events => events.OnLoad("function(e) { $(this).find('table').css('table-layout', 'fixed'); }"))
           .Columns(columns =>
           {
               if (Columns != null)
               {
                   foreach (EYCGridColumn item in Columns)
                   {
                        
                      columns.Bound(item.Key).Title(item.Header).Filterable(item.Filterble).Sortable(item.Sortable).Groupable(item.Groupable).Format(item.Format).Visible(item.IsVisible).HtmlAttributes(new { @style = "text-align:left" });
                   }                  
               }
               else
               {
                   columns.AutoGenerate(true);
               }
           })
            .DetailView(details => details.Template(e =>
                {
                    Html.Telerik().Grid(((SampleData)e).Children)
                    .Name("Orders_")
                    .HtmlAttributes(new { @class = "attachment-grid" })
                    .ClientEvents(events => events.OnLoad("HideHeader"))
                    .Columns(columns =>
                    {
                        if (Columns != null)
                        {
                            foreach (EYC.CRM.UI.ViewModels.Shared.UserControls.Grid.EYCGridColumn item in Columns)
                            {
                                            columns.Bound(item.Key).Title(item.Header).Filterable(item.Filterble).Sortable(item.Sortable).Groupable(item.Groupable).Format(item.Format).Visible(item.IsVisible).HtmlAttributes(new { @style = "text-align:left" });
  
                            }
  
                        }
                        else
                        {
                            columns.AutoGenerate(true);
                        }
                    })
                        //.DataBinding(dataBinding => dataBinding.Server().Select("_AjaxBinding", "Grid", new { clientID = "<#= ClientID #>" }))
                    .Footer(false)
                    .Render(); 
                }
                        )
                       )
                       .Pageable(paging => paging.Enabled(true)).Scrollable(scrolling => scrolling.Enabled(true))
                       .Sortable()

please help me resolving this issue

thanks and regards,
Ravindra

2 Answers, 1 is accepted

Sort by
0
Ravindra
Top achievements
Rank 1
answered on 26 Apr 2011, 07:18 AM
I have it resolved using a helper method to populate the template. Not sure why it is not working when we define the DetailView template inline?
0
Andrés
Top achievements
Rank 1
answered on 25 Jun 2011, 12:59 AM
I'm having this exact issue with a regular template column.
I had an action link, but then I simplified it to just this:

cols.Template(Sub(o)
      @<text>hello</text>
      End Sub)

The end result is a bunch of "hello"s side by side on top of the rendered table (one for each row) and then the actual grid. The column is displayed, but no content in it.

Any ideas?
Tags
Grid
Asked by
Ravindra
Top achievements
Rank 1
Answers by
Ravindra
Top achievements
Rank 1
Andrés
Top achievements
Rank 1
Share this question
or