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

Edit Template Checkbox Setting

1 Answer 117 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 19 Apr 2013, 08:30 AM
Hi,

I have a value that I am reading from a database as a 1 or 0 that I want to display in a list view as YES or NO and when editing as a checkbox...

I succesfully set the template to show YES or NO by using this code:
<div>#if(sup==1){#YES#}else{#NO#}#</div>

but I can not get the edit_template to show checked when sup == 1... it always displays unchecked.
Can you help with the proper syntax to read this value for a checkbox in an edit_template?

Thank you,
Andrew

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 22 Apr 2013, 03:08 PM
Hello Andrew,

Kendo Grid provides checkbox editing for boolean values out of the box. Configuring the same for fields of type number is not recommended - the build in checked binding works with boolean values.

I suggest you to define the field as boolean type and use the build-in editor (you can still display yes/no values through the template). At the parameterMap function of the DataSource, you can transform the boolean values into numbers and submit them to the server.

Kind regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView
Asked by
Andrew
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or