Empty strings and DBNull

I have a GDBG. One of the columns is type string. If I delete the contents of a cell in this column, the grid sets the cellvalue to an empty string (""). I am using the grid with an Oracle database, which does not allow empty strings. Is there a setting that I can use to automatically set the cell to DBNull.Value instead of an empty string? Or, do I have to use the CurrentCellValidated event?

1 Reply

AD Administrator Syncfusion Team February 3, 2006 11:59 AM UTC

Hi Keyur, You can use the CurrentCellValidating event for validating the cell value. Here is the code snippet. private void gridDataBoundGrid1_CurrentCellValidating(object sender, System.ComponentModel.CancelEventArgs e) { GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell; if(cc.Renderer.ControlText == "") cc.Renderer.ControlValue = System.DBNull.Value; } Let us know if you need further assistance, Regards, Madhan.

Loader.
Up arrow icon