very strange effect when databinding a grid

I have a a ggc that was working fine previously. All of a sudden, I'm getting a null reference error at the THIRD line below...

this.gridGroupingControl2.DataSource = dtSpot;
this.gridGroupingControl2.TableDescriptor.VisibleColumns.Clear();
this.gridGroupingControl2.TableDescriptor.VisibleColumns.Add("Selected");
this.gridGroupingControl2.TableDescriptor.Columns["Selected"].Appearance.AnyRecordFieldCell.CellType = "CheckBox";

BAsically, I am setting the datasource and using the visible columns property to selectively show and rearrange columns.

When I commented out all the other code besides the first line..

this.gridGroupingControl2.DataSource = dtSpot;

... all I see is the blank outline for the grid. The grid is not binding and the datasource clearly has data.

Basically nothings happens and there is no indication that something is wrong.

4 Replies

JB James Blibo December 27, 2006 08:02 PM UTC

This is strange... I delete the grid from the form and added it back with the same name and everything is working again.

Is there some in-memory caching that is going on that might have caused this?


AD Administrator Syncfusion Team December 28, 2006 09:47 AM UTC

Hi James,

In general, this problem occured when the datatable doesn't have the column( 'Selected' ) in the underlying datasource( 'dtSpot') of the grid. Could you please double check with your underlying datasource('dtSpot') having the 'Selected' coulmn?

Regards,
Haneef


AD Administrator Syncfusion Team December 28, 2006 10:07 AM UTC

Hi James,

In general, this problem occured when underlying datasource('dtSpot') of the grid doesn't have the column('Selected'). Could you please double check with your underlying datasource('dtSpot') ?

Regards,
Haneef


JB James Blibo December 28, 2006 03:09 PM UTC

The column "Selected" was in the datatable. That's OK, it's working now. I just found the problem weird.

Loader.
Up arrow icon