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

[Solved] checkbox column won't show checkbox column until entering edit mode

1 Answer 62 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
David
Top achievements
Rank 1
David asked on 24 Nov 2010, 11:03 AM

Hello,


Hello there,

I am using latest 3.1111 in my project. And I trying to follow  the checkbox ajax demo. However I couldn't get the checkbox behavior as I expected.  You can repro my issue from this website.

Repro Step:
1. when you load the page, you will find the first column showed the DeviceID value but not checkbox
2. Click Edit, you are now in editng mode and the checkbox showed up.
3. Click update/cancel, go back to the display mode. Now you get one checkbox and one deviceid value.
4. If you refresh the page, the checkbox will be gone.

Below is the code for my View page.  I am under pressure to get the demo site ready before Christmas. So if anyone could shed some light on this bizzare. A big thank you!

<%    Html.Telerik().Grid(Model) 
                .Name("Device"
                .ToolBar(commands => commands.Insert().ButtonType(GridButtonType.Image)) 
                .DataKeys(keys => keys.Add(c => c.DeviceID)) 
                .DataBinding(db => db.Ajax() 
                    .Select("Select", "Device"
                    .Insert("CreateDevice", "Device"
                    .Update("UpdateDevice", "Device"
                    .Delete("DeleteDevice", "Device")) 
                .Columns 
                (columns => 
                    
                        columns.Bound(e => e.DeviceID) 
                                  .ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#=DeviceID#>' />"
                                  .Title(""
                                  .Width(50) 
                                  .HtmlAttributes(new { style = "text-align:center" }); 
                
                        //columns.Bound(e => e.DeviceID); 
                        columns.Bound(e => e.DeviceKey).Width(50); 
                        columns.Bound(e => e.DeviceType).Width(50); 
                        columns.Bound(e => e.InStockDate).Width(200).Format("{0:yyyy-MM-dd}"); 
                        columns.Bound(e => e.SaleDate).Width(200).Format("{0:yyyy-MM-dd}"); 
                        columns.Bound(e => e.isRegistered).ClientTemplate("<input type='checkbox' disabled='disabled' name='isRegistered' <#=isRegistered? checked='checked' : '' #> />").Width(50); 
                        columns.Bound(e => e.isSpecialIDC).ClientTemplate("<input type='checkbox' disabled='disabled' name='isSpecialIDC' <#=isSpecialIDC? checked='checked' : '' #> />").Width(50); 
                        columns.Command(commands => 
                            
                                commands.Edit(); 
                                commands.Delete(); 
                            }).Title("Commands"); 
    
                    
                 
                 .Editable(editing => editing.Mode(GridEditMode.InLine)) 
                 .Pageable(p => p.Enabled(true)) 
                 .Sortable(s => s.Enabled(true)) 
                 .Filterable(f => f.Enabled(true)) 
                 .Selectable() 
                 //.ClientEvents(events => events.OnRowDataBound("onRowDataBound")) 
                 .Render(); 
              %>



Here is my model define and GetDevice Function.

public class DeviceData
    {
          
        [ReadOnly(true)]
        public int DeviceID { get; set; }
        public int? CustomerID { get; set; }
        public int? VehicleID { get; set; }
  
         public string DeviceType { get; set; }
  
         public string DeviceKey { get; set; }
  
         public DateTime? InStockDate { get; set; }
  
         public DateTime? SaleDate { get; set; }
          
         public string Sales { get; set; }
  
         public string DeviceStatus { get; set; }
  
         public string Invoice { get; set; }
  
        public string RefundStatus { get; set; }
          
        public bool isRegistered { get; set; }
        public bool isSpecialIDC { get; set; }
        }
  
 public IQueryable<DeviceData> GetDevice()
        {
            return from vd in ccf20Ent.Devices
                   select new DeviceData
                   {
                       DeviceID = vd.DeviceID,
                       CustomerID = vd.Customer.CustomerID,
                       VehicleID = vd.Vehicle.VehicleID,
                       DeviceStatus = vd.DeviceStatus,
                       DeviceKey = vd.DeviceKey,
                       DeviceType = vd.DeviceType,
                       InStockDate = vd.InStockDate,
                       Invoice = vd.Invoice,
                       Sales = vd.Sales,
                       SaleDate = vd.SaleDate,
                       isRegistered = vd.IsRegistered ?? false,
                       isSpecialIDC = vd.IsSpecialIDC ?? false
                   };
              
        }   
         

1 Answer, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
answered on 24 Nov 2010, 06:24 PM
Hi,
Just want to point out that your can easily see the issue in this website. http://www.northamericastudy.org/Device/Device
Also in my original post, I have attached a step by step screenshot to descripe the issue.

Thx,
David

Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or