If I want to display a checkbox in the grid. Whats the best way to do that?
I am doing this and it doesn't seem to work.
I am doing this and it doesn't seem to work.
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Template(@<input type="checkbox" />);
columns.Bound(r => r.RouteName);
})
.Pageable()
.Sortable()
.Scrollable()
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
)
)
5 Answers, 1 is accepted
0
Hi Jaime,
In order to achieve this you should use ClientTemplate for the Grid's columns. For example:
the Telerik team
In order to achieve this you should use ClientTemplate for the Grid's columns. For example:
@(Html.Kendo().Grid(Model)
.Name(
"Grid"
)
.Columns(columns =>
{
columns.Template(p => { }).ClientTemplate(
"<input type='checkbox' class='checkbox'/> "
);
columns.Bound(r => r.RouteName);
})
//....
)
Regards,
Iliana Nikolovathe Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Ling Ling
Top achievements
Rank 1
answered on 07 Jan 2014, 09:02 PM
That worked, however, the check box is editable even when the grid is not in edit mode. So I added disabled='disabled' 'checked=checked' in the template. That worked for the boxes that are checked, but the 'unchecked' box is still editable. how do you get around that? thx
0
Hello Ling,
In order to be able to edit only enabled checkboxes you could use the JavaScript conditional operator:
Regards,
Iliana Nikolova
Telerik
In order to be able to edit only enabled checkboxes you could use the JavaScript conditional operator:
//....
columns.Bound(p => {}).ClientTemplate(
"#= (//condition here//) ? \"<input type='checkbox' checked='checked'/>\" : \"<input type='checkbox' disabled='disabled' />\" #"
);
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

SOLOMON
Top achievements
Rank 1
answered on 16 Jan 2014, 03:18 PM
Is it possible to display the Checkbox only in the inline edit mode and not any other time? Display some text the other time?
0
Hello Solomon,
We have an online demo which demonstrates the described behaviour in action.
Regards,
Iliana Nikolova
Telerik
We have an online demo which demonstrates the described behaviour in action.
Regards,
Iliana Nikolova
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!