Checkbox column not reflecting the check

Hi, 

I manually added a checkbox column to my datagrid, then loaded the rest from a datatable.
When I check on a checkbox, it doesn't check.  I also need to be able to check multiple rows.
I added the code I used to add the checkbox column to an project you gave me for my last question.

Could you also show me how to map columns from the datasource manually?

Thanks,
Karla

Attachment: Sample1757678857_aa2c6f18.zip

1 Reply

VS Vijayarasan Sivanandham Syncfusion Team April 1, 2021 05:16 PM UTC

Hi Karla Franke,

Thank you for contacting Syncfusion Support.

Please find answer for your queries below 
Queries 
Solutions 
I manually added a checkbox column to my datagrid, then loaded the rest from a datatable. 
When I check on a checkbox, it doesn't check.  I also need to be able to check multiple rows. 
I added the code I used to add the checkbox column to an project you gave me for my last question. 

We have checked the provided sample from our end. In this sample CheckBoxColumn does not define with underline Boolean type property. So, check or uncheck the checkbox in SfDataGrid does not changes the check and unchecked state.

You can resolve the reported issue by define the Boolean type property in model class. Please refer the below code snippet,

 
  private bool _bulkUpdate; 
 
        //define the under line boolean type property 
        public bool BulkUpdate 
        { 
            get 
            { 
                return _bulkUpdate; 
            } 
            set 
            { 
                _bulkUpdate = value; 
                this.OnPropertyChanged("BulkUpdate"); 
            } 
        } 
 
 
  GridCheckBoxColumn column1 = new GridCheckBoxColumn(); 
            column1.AllowEditing = true; 
            column1.MappingName = "BulkUpdate"; 
            column1.HeaderText = "Incl"; 
            sfDataGrid1.Columns.Add(column1); 
 

For more information, please refer the below UG link,
UG Link: https://help.syncfusion.com/windowsforms/datagrid/gettingstarted#creating-data-for-sample-application         

SfDataGrid allows you to select or deselect individual rows through CheckBox using GridCheckBoxSelectorColumn, which is not bound with data object from underlying data source, and it can be added like normal columns.

For more information, please refer the below UG link,
UG Link: https://help.syncfusion.com/windowsforms/datagrid/columntypes#gridcheckboxselectorcolumn 


 
Could you also show me how to map columns from the datasource manually? 

Based on provided information we suspect that you need to manually generate the column in SfDataGrid. Please refer the below code snippet,

 
//Define the column Manually 
            this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "OrderID", HeaderText = "Order ID" }); 
            this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "CustomerID", HeaderText = "Customer ID" }); 
            this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "ProductName", HeaderText = "Product Name" }); 
            this.sfDataGrid1.Columns.Add(new GridTextColumn() { MappingName = "ShipCountry", HeaderText = "Country" }); 
            this.sfDataGrid1.Columns.Add(new GridNumericColumn() { MappingName = "Quantity", HeaderText = "Quantity" }); 

For more information, please refer the below UG link,

UG Link: https://help.syncfusion.com/windowsforms/datagrid/columns#manually-defining-columns
 



 

Sample Link: https://www.syncfusion.com/downloads/support/forum/164090/ze/SfDataGrid_WinForms_Demo-1124419896

Please let us know, if you require further assistance on this.

Regards,
Vijayarasan S
 


Loader.
Up arrow icon