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

Make A CheckBox Default To Unchecked When Adding New Record To A Grid

1 Answer 375 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 07 Jul 2016, 04:16 PM
When I add a new record to my grid with InLine editing enabled, the boolean columns that I have bound and are rendered as checkboxes are always checked by default.  How can I make them unchecked by default when adding a new record?

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 12 Jul 2016, 11:14 AM
Hello John,

Generally, the checkboxes should appear unchecked:
http://demos.telerik.com/aspnet-mvc/grid/editing-inline

Alternatively, you can also achieve this requirement using the Edit event handler of the grid:
http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-edit

And accessing the client-side object of the checkbox. Here are some hints:
.Events(events => events.Edit("onEdit"))
JavaScript:
Copy Code
Copy Code
function onEdit(args) {
    if (args.model.isNew() == false) {
            // textbox
            $("#ShipName").attr("readonly", true);
             
            // dropdownlist
            var kendoDdl = $("#ShipCountry").data("kendoDropDownList");
            kendoDdl.readonly(true);
    }
}

I hope this will prove helpful. 


Regards,
Eyup
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or