Thursday, February 08, 2007

Error message: column does not belong to table

Problem

For some reason I got a big red cross whenever I try to save a datagrid.
It seems like happened in the following sequence.
1) The grid must be wider then your windows resolutions
2) open the grid, use the horizontal scroll bar go all the way to the right
3) modify something and hit save.

A Big red cross come up instead of the refreshed grid.

Solution

After try an error for a while I find out a simple solution is to set the grid data source to null before I use SetDataBinding ()
thus the code is something like this
                gridX.DataSource =null;
                gridX.SetDataBinding( XXXDataView, "" );
                gridX.Refresh();

--
Thanks,

Gary


--
Thanks,

Gary