Anokrize Anokrize - 4 years ago 346
ASP.NET (C#) Question

KendoUI grid checkbox column

Currently I am having this code for displaying a KendoUI grid:

.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax() // Specify that ajax binding is used
.Read(read => read.Action("Products_Read", "Action")) // Set the action method which will return the data in JSON format
.Columns(columns =>
columns.Bound(product => product.Datum).Format("{0:dd.MM.yyyy}");
columns.Bound(product => product.Aktion);
columns.Bound(product => product.Ergebnis);
columns.Bound(product => product.Wiedervorlage).Format("{0:dd.MM.yyyy H:mm}");
columns.Bound(product => product.Bemerkung);
columns.Bound(product => product.Erledigt);
.Pageable() // Enable paging
.Sortable() // Enable sorting

I tried already this:

columns.Bound(product => product.Erledigt).ClientTemplate(
"<input type='checkbox' value='#= ProductID #' " +
"# if (Enabled) { #" +
"checked='checked'" +
"# } #" +

But if I add this, there is no data displayed in the grid...

The values of the last column which is
are displayed as true or false. Is it possible to display them as checkboxes?

I am using Telerik KendoUI and loading the content of the template via AJAX.

Answer Source

You can check the following FAQ page:

In addition, you can make the checkbox readonly or disabled to prevent the user from editing it and expect the changes to be persisted.


The code that you have tried contains two data field values, which obviously do not exist in your Grid: ProductID and Enabled. Most probably you are getting a JavaScript error in the browser console. Replace Enabled with Erledigt and remove value='#= ProductID #' if you don't need such a thing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download