Kendo Grid show model for checkbox

1k views Asked by At

I want to use my @item.Default which will return boolean as true if the value is true. I'd like to display it as a checkbox within my asp.net mvc kendo grid. This is the code I have but obviously it won't pull from the model to show that the value needs to be checked.

@(Html.Kendo().Grid<net_2_0_OBOE.OpenAccess.OBClientSetup>()
          .Name("grid")
          .Columns(columns =>
          {
              columns.Bound(obcs => obcs.SetupID);
              columns.Bound(obcs => obcs.ProfileName);
              columns.Bound(obcs => obcs.Default).ClientTemplate("<input type='checkbox' #= Error ? checked='"
                   + @item.Default + "': '' # class='disabled' />");
              columns.Bound(obcs => obcs.EEFinalize);
              columns.Bound(obcs => obcs.AllowOutsideCodes);
              columns.Bound(obcs => obcs.Completed);
              columns.Command(command =>
              {
                  command.Edit();
                  command.Destroy().HtmlAttributes(new {@class = "onboard-delete "});
              });
          })
1

There are 1 answers

1
hutchonoid On

You simply need to concatenate the razor as follows:

.ClientTemplate("<input type='checkbox' #= Error ? checked='" 
                       + @item.Default + "': '' # class='disabled' />");