Edit Template Checkbox Setting

2 posts, 0 answers
  1. Andrew
    Andrew avatar
    4 posts
    Member since:
    Apr 2013

    Posted 19 Apr 2013 Link to this post

    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
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 22 Apr 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top