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

[Solved] Grid with Template column within Tab Strip

2 Answers 118 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Gene
Top achievements
Rank 1
Gene asked on 18 Apr 2012, 02:36 PM
I am trying to place a grid with a template column within a tab on a tab strip, but am running into problems because of the 2 level limitation. Here is the block of code for the tab item:

            tabstrip.Add()
                .Text("Documents")

                .Content(@<text>
                    @{Html.Telerik().Grid<ProVisionClaims.Models.DOCUMENT>()
                    .BindTo((IEnumerable<ProVisionClaims.Models.DOCUMENT>)ViewData["Documents"])
                    .Name("Documents")
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.ID).Title("DOC ID").Width(70);
                        columns.Template(c =>
                        {
                            @<text>
                            <a href="@Url.Action("OpenDocument", new { id = c.ID, claim = c.ClaimID })">@c.DESC</a>
                            </text>
                        });
                        columns.Bound(c => c.DESC).Title("Description").Width(100);
                        columns.Bound(c => c.DOCCAT).Title("Category").Width(100);
                        columns.Bound(c => c.DOCTYPE).Title("Type").Width(100);
                        columns.Bound(c => c.CREATEDATE).Title("Created").Width(100);
                    })
                    .Pageable()
                    .Sortable()
                    .Filterable()
                    .Render();
                    }
                </text>);

Specifically, the nested <text></text> tags are not permitted. I have reviewed the doc page for replacing the inner grid with a helper, but am confused regarding the syntax. Any help would be greatly appreciated.

Thanks,
Gene

2 Answers, 1 is accepted

Sort by
0
Accepted
Pechka
Top achievements
Rank 1
answered on 18 Apr 2012, 03:40 PM
Use different oveloads of the Content and Template methods - for example for the Content you can use
Content(Html.Telerik().Calendar().ToHtmlString())  
0
Gene
Top achievements
Rank 1
answered on 18 Apr 2012, 05:56 PM
Pechka,

Thank you! I got it to work. For those interested, here is the adjusted code:

            tabstrip.Add()
                .Text("Documents")
                .Content(
                    Html.Telerik().Grid<ProVisionClaims.Models.DOCUMENT>()
                    .BindTo((IEnumerable<ProVisionClaims.Models.DOCUMENT>)ViewData["Documents"])
                    .Name("Documents")
                    .Columns(columns =>
                    {
                        columns.Bound(c => c.ID).Title("DOC ID").Width(70);
                        columns.Template(
                        @<text>
                           <a href="@Url.Action("OpenDocument", new { id = @item.ID, claim = @item.ClaimID })">@item.DESC</a>
                         </text>
                        ).Title("Document");
                        columns.Bound(c => c.DESC).Title("Description").Width(100);
                        columns.Bound(c => c.DOCCAT).Title("Category").Width(100);
                        columns.Bound(c => c.DOCTYPE).Title("Type").Width(100);
                        columns.Bound(c => c.CREATEDATE).Title("Created").Width(100);
                    })
                    .Pageable()
                    .Sortable()
                    .Filterable()
                    .ToHtmlString()
                    
               );

Tags
TabStrip
Asked by
Gene
Top achievements
Rank 1
Answers by
Pechka
Top achievements
Rank 1
Gene
Top achievements
Rank 1
Share this question
or