I have code like the following :-
grid.DataSource=table (an ADO.Net DataTable)
This has been working fine until now when it generates a system OutOfRangeException ("Index was out of range"). Looking in debug the Binder.InternalColumns collection is empty.
I know the DataTable contains valid data.
Am I doing something wrong?
I thought that assigning a DataSource to the grid caused it to automatically bind to all the columns in the DataSource. Is this not correct?
I have purchased the source code - what do I have to do to trace into the source?
ADAdministrator Syncfusion Team August 4, 2004 01:10 AM
As long as you are not using hiearchical data (added Relations to the dataSet.Relations collection), and have not explicitly added GridBoundColumns, then grid.Binder.InternalColumn should be populated after setting the grid.DataSource to a DataTable provided the DataTable has columns in it.
If it is empty under these conditions, then either it was reset for some reason, or was somehow never set. You might look in your output window to see if any exceptions are thrown during the code that tries to set up the DataSource and set it to the grid. You also might place a stop on the code that sets the DataSouorce to the grid to make sure it is being hit.
As far as a using a debug build of our libraries, the simplest way is to run our Assembly Maanger (from the Syncfusion portion of the Start Menu). It will let you select a debug build (click force rebuild if it is not selected). This will do everything for you, building the libraries and setting them into teh GAC. Then later you can run the Assembly Manager to go back to using the prebuilt default libraries.
MSMick SpeakeAugust 4, 2004 03:20 AM
Thanks for your reply.
For your information, I resolved the problem as follows:-
By stepping into the grid source code I found that the binder.BindingContext had not been set. This was caused by the .Net designer "losing" the fact that the grid control was on a panel.
Having spent a few weeks trying to convert a C++/MFC app to c# and staggering from problem to problem, I wonder if it is worth the effort!