|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
EndCurrentEdit does not push changes into the datasetlist of records. When the user selects a row in the grid, the full details of the record display in a panel which contains textboxes and comboboxes. The underlying datatable that the detail panel is bound to only ever has one record at a given time. When the user edits the detail record and then issues a save command by clicking the save button, all works well. This is because the focus moves from the current control and current record to the button. However if the user issues a Save by pressing the F2 key (caught by the form's ProcessCmdKey), the focus remains in the current control and current record. Under these circumstances, the EndCurrentEdit will not push the changes into the dataset. I tried calling EndCurrentEdit() on each control (in the control leave event) in the following ways: control.BindingContext[dataset.Tables[datatablename]].EndCurrentEdit(); if (control.DataBindings.Count > 0) { control.DataBindings[0].BindingManagerBase.EndCurrentEdit(); } I tried calling EndEdit() on the datatable row dataset.Tables[datatablename].Rows[rownumber].EndEdit() I then implemented a BindingManagerBase as follows: bindMgrBase = this.BindingContext [mydataset, datatablename]; and on save called bindMgrBase.EndCurrentEdit() I tried 1) moving programmatically to the next textbox control 2) moving programmatically back to the datagrid 3) moving programmatically to a button I suspect that the EndCurrentEdit() requires the user to move off the current record. That is difficult to test as the record detail panel only ever has one record at a given time. Is there any way to make this work? Anyone have any ideas for me? ....Susan Susan,
Did you try to set the endcurrentedit exactly before your updatecommands (of course including things as haschanges and methods like that). Normally that is the place that it is needed. Or do you use it for something else? Where it is as well needed is as you use expressioncolumns showing the result on the screen. I hope this helps, Cor |
|||||||||||||||||||||||