Grid Popup with bool or bool? doesn't work

1 Answer 64 Views
Checkbox Editor Form Grid
Top achievements
Rank 1
Chandini asked on 07 Dec 2021, 11:42 AM | edited on 07 Dec 2021, 12:03 PM


   I wonder if you could help. I have a Kendo UI grid that has 2 bool elements, this is a MVC core 3.1 project.  When I click on the Create or Update buttons on the Edit popup, nothing happens - no errors and the controller action is not being called. 

    I have code similar to the following code for the grid itself : 

    .DataSource(dataSource => dataSource
        .Model(m => m.Id(e => e.Id))
        .Read(read => read.Action("Read", "ActionRead"))
        .Create(create => create.Action("Create", "ActionCreate"))
        .Update(update => update.Action("Update", "ActionUpdate"))
        .Events(events => events.Error("onError"))
    .Columns(columns =>
        columns.Bound(p => p.Name);
        columns.Bound(p => p.IsCompleteStatus).ClientTemplate("<input type='checkbox' #= IsCompleteStatus ? checked='checked' :'' # />"); 
        columns.Bound(p => p.IsPendingStatus);
columns.Command(command =>
            command.Custom("Remove").Click("onRemove").Visible("isRemoveable").IconClass("k-icon k-i-delete k-icon-32");
            command.Custom("Restore").Click("onRestore").Visible("isRestorable").IconClass("k-icon k-i-reset k-icon-32");
    .ToolBar(toolbar => toolbar.Create().Text("Add Status"))
    .Editable(editable => editable.Mode(GridEditMode.PopUp))

And this is what I have in my view for the popup window: 


    <div asp-validation-summary="ModelOnly" class="text-danger"></div>
    <input asp-for="Id" type="hidden" />
    @Html.FormGroupFor(m => m.Name)
    @Html.EditorFor(m => m.IsCompleteStatus)  
  @Html.FormGroupFor(m => m.IsPendingStatus)

The popup displays fine. However clicking on the Create button (when I hit 'Add') or the Update button (when I click on 'Edit') does absolutely nothing, unless I actually check the checkbox. 

If it is a bool type, it also doesn't let me leave it empty, so it needs it checked all the time.

If it a bool? type, it doesn't let me interact with it at all - I cannot check the boxes, so no Create/Update either.    If I remove the checkboxes from the view, it displays and works fine.  Can you help please? Thank you 

1 Answer, 1 is accepted

Sort by
Telerik team
answered on 09 Dec 2021, 06:24 AM

Hi Chandini,

When a boolean value is required in the popup editor, the validator would want it to always be "true" because it considers the "false" value as invalid. Therefore, the boolean field should be set up as follows:

        public bool Discontinued
The following example shows this scenario in action:

Also, could you let me know what is the implementation of the editor? There should be a view in the EditorTemplates folder of the project where the EditorFor() helper will search into.

Looking forward to your reply.


Kind regards,
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Top achievements
Rank 1
commented on 09 Dec 2021, 08:14 AM

Hi, this is how the bool is set up in our class

 public bool IsCompleteStatus { get; set; }

I have tried it with and without an editor template.  And just using an <input type.... >  none of these actually work. 

Telerik team
commented on 13 Dec 2021, 04:34 PM

Hi Chandini, I double-checked the provided code snippets and there is nothing incorrect that I could spot. Is it possible for you to share a minimal sample where this issue can be replicated? 
Checkbox Editor Form Grid
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question