|116328||May 14,2014 09:16 PM UTC||Jun 12,2014 04:08 AM UTC||WPF||7|
Following the SF help from: http://help.syncfusion.com/ug/wpf/grid/default.htm#!documents/databasedata.htm
I have made a code behing connection of a SQLite database with a GridDataControl and binding
this.GridDataControl_Left.ItemsSource = this.GetDataTable();
public DataTable GetDataTable()
SQLiteConnection engine = new SQLiteConnection(DBConnString );
SQLiteDataAdapter sda = new SQLiteDataAdapter("SELECT * FROM Names", engine);
DataSet ds = new DataSet();
As my database can be changed on user prefference, I do not know in advance what fields are inside, so I import all the field of one db table, to be binded with the corresponding column in the GDC
The grid reflect corrrectly the database (one direction), that is OK, but when I modify data in the grid, these changes are not updated in database. So not woking Bidirectionnaly now :(
Can you please modify this code or tell me what to add for that ?
(PS: for community, maybe could also be good to later include in the help file and use SQLite and not SQLce as SQLce is deprecated...but that is a different story)
I implemented the CurrentCellEditingComplete event suggested ... but ...
although it works good for string or number cell that you do click "enter" when done
... it works very bad with checkbox cell type
if you mouse click the checkbox in the grid, it is visually changed, but the event is not raised until you click another cell or user enter key
Very confusing for user as visually it is changed, so the action is (should!) be finished
... and if you made such checkbox click and then do not click on that control anymore but do something else on the GUI, it is possible that the event is never raised
bug or at least a very unexpected behaviour ? a workaround or to bug report ?
PS: changing to another event type (one that is activated before) works better from user point of view, but in fact not, as the logical value of the cell is not updated yet, so incorrect reading by code behind raised by event; so not an option
Thank you for using Syncfusion Products.
We analyzed your query. CurrentCellEditingComplete Event will not be fired when you change the value of checkbox and it will be fired only after the EndEdit() method.
If you want to access the cell value of check box when you click on a cell, you can use CurrentCellChanging or CurrentCellChanged Event instead CurrentCellEditingComplete.
Please let us know if you have any queries.
I tried the two events suggested.
None work as when they are raised, the value is not changed yet in the grid .... so reading the grid at that moment returns the previous info, not the one changed/updated/added
Any idea ?
All the column defined in the GridDataControl will update value based on the UpdateMode property. The default value of the UpdateMode is LostFocus, so all the column update the values to the underlying collection when the current cell is out of focus or moved to another cell. If you set the UpdateMode property as PropertyChanged then only all the column will update the values to the underlying collection when property is changed.
The UpdateMode property also available in column level. If you want to set the value immediately when you interact with the checkbox column, then set the UpdateMode property as PropertyChanged in the checkbox column and also set NotifyPropertyChanges as True in GridDataControl
Please let us know if this solution helps you.
the two settings, together with CurrentCellChanged event, does the correct behaviour
(not with CurrentCellEditingComplete which was still requiring another cell to be selected)
Thanks for your update.
CurrentCellEditingComplete event will be triggered only when the cell changes from edit mode to non-edit mode. But in the case of CurrentCellChanged Event, event will be triggered when the value is changed in editor which is placed within the cell. This is the actual behavior of those events.
If you need any further assistance, feel free to discuss with us. We will always happy to assist you.
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.
or the page will be automatically redirected to sign-in page in 10 seconds.