I have a problem with the RadGridView because I need to set column names manually, and I don't have a constant number of columns.
I have a data class that looks something like this:
And then I have the following list with the actual data:
The problem is that I want the GridView to show one column for Time property (I can bind this to MyItemData.Time), but I also want a column for each element in the Values list, named by corresponding name in ColumnNames list. That means that I can't bind the other columns to object properties, as there are no objects that can contain variable number of properties. I have values for each column (with the names in the separate list) in the MyItemData.Values list, but I don't know how to populate the GridView from such data source. And I can't find any way to populate rows by column index.
What would be the right approach for populating the GridView with a data source like this?
Note: I don't need any editing possibilities, I just need to represent the data.
I have a data class that looks something like this:
public
class
MyItemData
{
public
DateTime Time {
get
;
set
; }
public
List<
int
> Values {
get
;
set
; }
public
List<
string
> ColumnNames {
get
;
set
; }
}
And then I have the following list with the actual data:
public
void
PopulateGrid()
{
List<MyItemData> data = DB.GetData();
// Populate grid from data...
// ...
}
The problem is that I want the GridView to show one column for Time property (I can bind this to MyItemData.Time), but I also want a column for each element in the Values list, named by corresponding name in ColumnNames list. That means that I can't bind the other columns to object properties, as there are no objects that can contain variable number of properties. I have values for each column (with the names in the separate list) in the MyItemData.Values list, but I don't know how to populate the GridView from such data source. And I can't find any way to populate rows by column index.
What would be the right approach for populating the GridView with a data source like this?
Note: I don't need any editing possibilities, I just need to represent the data.