I have a RadGrid that's using a RadImageColumn to display an image based on the value of a field in the data source, which is working perfectly fine.
However, when my datasource is bound to a collection of an interface type, I'm getting the error "Object does not match target type".
My classes are structures as follows:
interface I
{
string ImageURL
}
class A : I
{
string ImageUrl { get { ... } }
}
class B : I
{
string ImageURL { get { ... } }
}
I'm binding to a datasource that is a collection of items of type I. What appears to be happening is that when my datasource only contains records of either type A or only records of type B, the grid binds succesfully. The problem seems to occur when I try to bind to a datasource that contains both types, and only occurs the first time it tries to bind to the second type. Presumably this might also cause problems with abstract classes, or other derived properties.
However, when my datasource is bound to a collection of an interface type, I'm getting the error "Object does not match target type".
My classes are structures as follows:
interface I
{
string ImageURL
}
class A : I
{
string ImageUrl { get { ... } }
}
class B : I
{
string ImageURL { get { ... } }
}
I'm binding to a datasource that is a collection of items of type I. What appears to be happening is that when my datasource only contains records of either type A or only records of type B, the grid binds succesfully. The problem seems to occur when I try to bind to a datasource that contains both types, and only occurs the first time it tries to bind to the second type. Presumably this might also cause problems with abstract classes, or other derived properties.