I have an ultragrid, it is bound to a bindingsource, this binding source is created by BindingSource= new bindingsource(dataset, "TableName"), and then datagrid.datasource=BindingSource.
When I delete one row in the datagrid, that is is disappeared, but in the dataset, that record is still existed in the datatable, and the RowState is "unchanged".
so the record is deleted from datagrid, but not deleted from datasource.
who can help me with this?
I'm not sure why that would be. The grid commits changes to the data source based on the UpdateMode property, which defaults up updating when the active cell changes or the grid loses focus. Deleting a row in the grid should certainly cause a change in the ActiveCell. So maybe you have changed the UpdateMode property of the grid to some other setting?
Try calling grid.UpdateData and see if that helps.
How are you getting the data row? Are you sure it's the right row?
I have the same symptom of a grid deleting only from the display, but my datasource is from an sp. I'd like to be able to delete from one of the tables in said sp but I'm not sure what the best way would be. My grid's UpdateMode is set to OnRowChangeOrLostFocus.
I had the same issue.I tried calling UpdateData()...still didn't work. Here is how I got around the issue:
Int32 index = grid.ActiveRow.Index;
grid.ActiveRow.Delete(true); //this seems to delete from the grid only...won't change the datasource even when calling UpdateData()
myDataSet.myTable.Rows.RemoveAt(index); //remove from the underlying table directly by using the index from the grid
Mike...this might be something worth testing out