Question

I have just come across a Casting Exception while using the Telerik RadGrid.

It occurs during the DataBind event if I have an array of objects as the datasource

radgrid1.DataSource = new BaseObject[] { new ChildObject1(), new ChildObject2() };

where the classes ChildObject1 and ChildObject2 both inherit from the class BaseObject.

Was it helpful?

Solution

Just found the answer.

var objects = new BaseObject[] { new ChildObject1(), new ChildObject2() }; radgrid1.DataSource = new List<BaseObject>(objects);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top