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.
Unfortunately, activation email could not send to your email. Please try again.

save changes to checkbox to database

Thread ID:





132578 Sep 9,2017 11:06 PM Sep 12,2017 10:24 PM WPF 3
Tags: SfDataGrid
David Gammon
Asked On September 9, 2017 11:06 PM

I have a sfdatagrid with a gridcheckboxcolumn.  I need to update the database field bound to the checkbox when the checkbox becomes checked or unchecked.  I have tried the gridcheckbox and a checkbox imbedded in a datatemplate, but cannot get the database to be updated.

Jai Ganesh S [Syncfusion]
Replied On September 11, 2017 08:16 AM

Hi David, 
You can get the underlying record values and update it to database fields while we check/uncheck the GridCheckBoxColumn by wiring the CurrentCellValueChanged event.  
this.sfGrid.CurrentCellValueChanged += sfGrid_CurrentCellValueChanged; 
void sfGrid_CurrentCellValueChanged(object sender, Syncfusion.UI.Xaml.Grid.CurrentCellValueChangedEventArgs args) 
    int columnIndex = this.sfGrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex); 
    if (this.sfGrid.Columns[columnIndex].CellType == "CheckBox") 
        var record = args.Record; 
Jai Ganesh S 

David Gammon
Replied On September 11, 2017 12:38 PM

Can you show an example using visual basic?

Gnanasownthari Thirugnanam [Syncfusion]
Replied On September 12, 2017 10:24 PM

Hi David, 
We have prepared the sample for your requirement in VB as per your update, you can download the sample from below mentioned location. 
AddHandler Me.sfGrid.CurrentCellValueChanged, AddressOf sfGrid_CurrentCellValueChanged 
Private Sub sfGrid_CurrentCellValueChanged(ByVal sender As Object, ByVal args As Syncfusion.UI.Xaml.Grid.CurrentCellValueChangedEventArgs) 
       Dim columnIndex As Integer = Me.sfGrid.ResolveToGridVisibleColumnIndex(args.RowColumnIndex.ColumnIndex) 
       If Me.sfGrid.Columns(columnIndex).CellType Is "CheckBox" Then 
              Dim record = args.Record 
       End If 
End Sub 
Sample location: 
Gnanasownthari T. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.