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

[Solved] Template Column is empty are dataBind is called

1 Answer 98 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.
Gabe
Top achievements
Rank 1
Gabe asked on 22 Mar 2011, 09:23 PM
Sorry for the awful thread title, I typed too fast and didn't double check it....

I have a mvc grid that is rebinding using a callback from a .getJSON call.

 $.getJSON("Home/_CustomBinding", { getPageNumber: getpagenumber }, function (data) {
        var grid = $('#' + gridid).data('tGrid');
        grid.dataBind(data.Data);
 }, 'json');

The problem is, I have a checkbox column that is a template column and after the dataBind(), the column is just empty.

    @(Html.Telerik().Grid(Model.Data)
        .Name(Model.GridID)
        .Columns(columns =>
        {
            columns.Template(@<text>
                    <input onclick='updateSelection("@Model.GridID")' name="checkedRecords" type="checkbox" value="@item.ResultId" title="checkedRecords"/>
                </text>).Title("").Width(35);
            columns.Bound(o => o.FullName);
        })
        .Scrollable()
)

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 23 Mar 2011, 07:47 AM
Hello Gabe,

 This is expected. Server templates work only for server binding. You need to use client templates for client-side binding.

All the best,
Atanas Korchev
the Telerik team
Tags
Grid
Asked by
Gabe
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or