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

[Solved] ClientTemplate() and Template() at the same time?

1 Answer 122 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.
Ariel
Top achievements
Rank 1
Ariel asked on 02 Aug 2011, 07:54 PM
Hello,

I have the following code:
@using com.mycompany.myproject.web.ViewModels
@model IEnumerable<DeduccionViewModel>
 
@{ Html.Telerik().Grid(Model)
    .Name("Deducciones")
    .Columns(columns => {
        columns.Bound(p => p.IdDeducciones).ClientTemplate("<a href='#'><#= IdDeducciones #></a>");
    columns.Bound(p => p.FechaInscripcion).Width(50);
    columns.Bound(p => p.FechaFin).Width(400);
                        })
    .DataBinding(dataBinding => dataBinding
        //Ajax binding
        .Ajax()
        //The action method which will return JSON
        .Select("DeduccionesAjax", "Empleados", new { id = ViewBag.Id })
    )
    .Pageable(pager => pager.PageSize(2))
    .Sortable()
    .Render(); }

The grid renders fine but only uses the client template when I go to page 2 for instance. On the initial load it doesn't use it.
As a workaround I added .Template(@<text><a href='#'>@item.IdDeducciones</a></text>); after the ClientTemplate and now it works on both the initial load and afterwards. However this seems strange as none of the examples or docs I've seen specify both a Template and a ClientTemplate.

Is there something I'm missing that's making the first load not come from Ajax or something similar?

Thanks in advance,
Ariel Arjona

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 03 Aug 2011, 06:37 AM
Hello Ariel,

 Check this help article.

Regards,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Tags
Grid
Asked by
Ariel
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or