Hi,
How can I set a null value to an cell.
Regards,
Ceaser
I'm not familiar with a "string format is not correct" exception. But it sounds like some kind of conversion error. This probably has more to do with the data source and the data type of the column than it does to the ValueList.
Unless you are setting the style on the grid column to DropDownList, in which case the column will only accept values that exist on the list. In that case, your ValueList would have to contain a null item. Or maybe you can get what you want using the column's Nullable property - I'm not sure if that's supported in a case like this.
I have tried this but some occasion it is working and some times giving exception as string format is not correct.
I am using a valuelist for this cell and this value list will change at runtime (With respect to another cell in this same row).
When I need to set null, first I remove the valuelist from the grid and add null to the cell.
Once you have a reference to the cell, assign DbNull.Value to its Value property, like so:
this.ultraGrid.Rows[0].Cells[0].Value = DBNull.Value;
If there is more to this, please provide us with some additional details, and we will try to help.