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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

save changes to checkbox to database

Thread ID:





132578 Sep 10,2017 03:06 AM UTC Sep 13,2017 02:24 AM UTC WPF 3
Tags: SfDataGrid
David Gammon
Asked On September 10, 2017 03:06 AM UTC

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 12:16 PM UTC

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 04:38 PM UTC

Can you show an example using visual basic?

Gnanasownthari Thirugnanam [Syncfusion]
Replied On September 13, 2017 02:24 AM UTC

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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon