How do I bind an UltraGrid to a 2 dimensional array in c#?
Thanks.
Hello,
I am just checking about the progress of this issue. Let me know if you need my further assistance on this issue.
Thank you for using Infragistics Components.
Hi,
No, a List<T> of List<U> will not work. The columns in the grid come from the BindingManager, which gets them from the data in the row. So whatever object exists in your first List<T>, the properties of T become the grid columns. If T is a List<U>, then your grid columns will be the properties of List<U>, which won't return the items.
You will need to build some sort of data structure with the appropriate number of columns. If you don't want to use a DataTable, then I recommend using UltraDataSource.
I am using the grid in a bit of a different manner. Rather than each row representing a record, each cell represents a record. The user selects a cell. Therefore I have a class which take a list of values, in this case strings, and creates a 2d array with a specified width and height. I wan't to bind this to the UltraGrid, however I'd prefer not to use a Datatable if at all possible. Would a list of lists work? i.e. bind to an object like this: List<List<string>>?
Thank you for contacting Infragistics Developer Support.
Why do you need to bind the grid to a two dimensional array? Binding to arrays which are not one dimensional is not supported. What you could is to create a DataTable from the array and use this DataTable instead, see the attached sample.
Please let me know if you have any additional questions.