I have a WHDG with two bands, in the second band I have a checkbox. When I change the value in the checkbox and then immediately close the browser, the value is not saved to the database.
Is there something that can be done so any cells that are in edit mode will save their value to the database when the browser is closed?
Thanks,
Brian.
Hello Brian,
Thank you for posting in our forums.
Are you using BoundCheckboxField or UnboundCheckboxField, or TemplatedDataField?
What DataSource are you using to bound the WHDG to?
Have you set AutoCRUD = true or not?
http://help.infragistics.com/NetAdvantage/ASPNET/2011.2?page=Infragistics4.Web.v11.2~Infragistics.Web.UI.GridControls.EditingCore~AutoCRUD.html
If it is turned on and you have declared update command of the datasource, then the updating will be handled by it.
If you have turned it off you should handle the RowUpdating event of WHDG
Hope hearing from you
I'm using a BoundCheckBoxField, the database is a Access2007 using a SQLDataSource to bind it to the grid.
I have not turned off AutoCRUD. AutoCRUD is set to True.
The SqlDataSource2 (Band2) does not declare a different Update command other than the default, the "Specify columns from table or view" radio button is selected.
When the user moved to a different row after they have changed the checkbox then the value is saved, or if the user logs out after the changed the checkbox then the value is saved.
However, if the user exits the browser right after they changed the checkbox value, the value is NOT saved.
Any suggestions on what could be done to get the cell to exit edit mode when the browser closes?
Thank you for the clarification.
I got better idea what you are experiencing.
In this scanario I recommend you the following :
1) Handling the CellValueChanging client side event
2) Invoke the commit() method of the editingCore in case the updated cell is in the checkbox column
Thus you will be sure that the update will be saved before closing the browser
Please refer to the below code snippet
function WebDataGrid1_Editing_CellValueChanging(sender, eventArgs) {
///<summary>
///
///</summary>
///<param name="sender" type="Infragistics.Web.UI.WebDataGrid"></param>
///<param name="eventArgs" type="Infragistics.Web.UI.CancelCellValueChangeEventArgs"></param>
//Add code to handle your event here.
if (eventArgs.get_cell().get_column().get_key() == "CheckBoxField_0") {
sender.get_behaviors().get_editingCore().commit();
}
Let me know if you need further assistance