We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Checkbox

I am using Virtual GridControl in which one of the col type is "CheckBox". But I am not able to check and uncheck the col. I tried the follwing code piece even though it is not setting the value to the cell. GridCurrentCell cc = CurrentCell; if(cc.Renderer.StyleInfo.CellType == "CheckBox") { this.Model[cc.RowIndex,cc.ColIndex].CellValue = !((bool)cc.Renderer.ControlValue) ; } Pls help. Regards Ravi

1 Reply

AD Administrator Syncfusion Team May 17, 2006 04:00 AM UTC

Hi Ravichandran , You need to set the cell''s CheckBoxOptions property of the Grid. CheckBoxOptions.CheckedValue is used to specify what value should be given in the CellValue to make the checkbox checked (ie., either "1" or "true"). Say for example if you want "true" to be checked and "false" to be unchecked state. Here is the code snippet. this.gridControl1[1,1].CellType = "CheckBox"; this.gridControl1[1,1].CheckBoxOptions.CheckedValue = "true"; this.gridControl1[1,1].CheckBoxOptions.UncheckedValue = "false"; this.gridControl1[1,1].CellValueType = typeof(bool); this.gridControl1[1,1].CellValue = true; You can also set "1" and "0" to be checked and unchecked values in the similar way. Best Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon