Can't get ITypedList to work with custom collection when binding

  • Thread starter Thread starter Joe Jax
  • Start date Start date
J

Joe Jax

I'm building my own version of a readonly DataTable, which needs to bind to
various controls. My data table class has two main collections
(CollectionBase instances): one of columns, one of rows, where each row has
a collection of column values. I have implemented the ITypedList interface
on my rows collection, but when I bind the collection to a grid (asp.net
datagrid) it tells me that the specified properties don't exist. There is no
indication that the ITypedList.GetItemProperties() method is being invoked
so the binding process seems to be ignoring my custom property descriptors.
Any suggestions?
 
Joe Jax said:
I'm building my own version of a readonly DataTable, which needs to bind
to various controls. My data table class has two main collections
(CollectionBase instances): one of columns, one of rows, where each row
has a collection of column values. I have implemented the ITypedList
interface on my rows collection, but when I bind the collection to a grid
(asp.net datagrid) it tells me that the specified properties don't exist.
There is no indication that the ITypedList.GetItemProperties() method is
being invoked so the binding process seems to be ignoring my custom
property descriptors. Any suggestions?

Solution for anyone with the same problem in the future...

Additionally implement the ICustomTypeDescriptor on the row class. Use .NET
Reflector on the DataView and DataRowView classes for an example of how to
do this.
 
Back
Top