Hi Kevin,
The value of
e.Item.DataItem is an object, which corresponds to that row in the grid. If the datasource is a DataTable
e.Item.DataItem will hold a
DataRow. If the datasource is a list of custom objects
e.Item.DataItem will hold an instance of that custom object type.
That said, if your code looked like this:
you would get that message and you could simply cast
e.Item.DataItem to Test_VO2. However, your code snippet shows, that you use an anonymous type, so you would not be able to cast
e.Item.DataItem. A possible solution would be to use the above code and a line like this:
row["Shuttle"] = ((Test_VO2)(e.Item.DataItem).Shuttle;
Alternatively, you can create your own type, containing only the properties you need (Date, Shuttle, VO2, Max_Heart_Rate and Level) and use it like this:
Hope this helps.
Greetings,
Ves
the Telerik team