Getting the value of a checkbox column when clicking on the checkbox?

Hello.  I'm trying to update my database whenever a checkbox is checked but can't seem to get it to work.  If i put the update method into a CurrentCellEndEdit, then it works perfect.  isn't there a way to just do it whenever the button is clicked, get it's value (checked or unchecked, or True or False, and run my script.  right now, I have to click the checkbox then edit a cell for it to work and that's impractical to do everytime.grid.png ?




1 Reply

MA Manikanda Akash Munisamy Syncfusion Team October 4, 2024 10:11 AM UTC

Hi Kevin Davis,


We have reviewed your scenario for updating the database based on the CheckBox state. This can be achieved by handling the sfDataGrid.CellCheckBoxClick event. Based on the e.NewValue, you can call your update method. Here's a code snippet for reference:


sfDataGrid1.CellCheckBoxClick += SfDataGrid1_CellCheckBoxClick;
private void SfDataGrid1_CellCheckBoxClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellCheckBoxClickEventArgs e)
{
    //Change the condition accordingly
    if (e.NewValue == CheckState.Checked)
    {
        //Update Database
    }
}
If we have misunderstood your requirements or if you need further assistance, please provide additional details about the issue you're facing. This will help us offer a more tailored solution.
 
Thank you for your understanding and cooperation.

Regards,
Manikanda Akash

Loader.
Up arrow icon