I’ve been using the grid control to good effect for about half a year now in a sizable project. I recently ran into an curious effect, though.
In one particular form, I have a DataView object with a 9-column, 3-row DataTable in it. I attempt to set the grid’s .DataSource property to that view and then, immediately after, discover that the grid’s .Columns property has 0 columns in it, unlike all other cases I’ve seen. The behavior was 100% repeatable in this case; not sporadic.
I gave up attempting to find the cause and simply deleted and recreated the control on the form. That resolved it.
I’m not sure if there is a bug in the control or I simply used it incorrectly. Just wanted to add an instance to your knowledge base if this is a known issue.
– Jim Carnicelli
Imported from legacy forums. Posted by Jim Carnicelli (had 2256 views)
I’ve had this problem too, but I figured it out. The actual databinding happens when the GridControl itself needs the data for the first time (when painting). To force the databinding to happen immediately, do this: <pre>grid.DataSource = view; if (grid.BindingContext == null) grid.BindingContext = new BindingContext();</pre>
Imported from legacy forums. Posted by Tommy (had 198 views)