G
Guest
Hi All,
I was trying to apply databinding to a custom collection as in the MSDN
Magazine article found in the August, 2005 issue. After converting the code
in the article to C# and applying it to an existing set of classes, I tried
using the collection as the datasource for a standard DataGrid control. The
problem is that the collection contains a collection as one of it's member
properties (ie. SampleCollection contains a SampleParameterCollection). The
DataGrid control seems to correctly detect that a heirarchy exists as it
displays the expander "[+]" and shows the name of the inner collection on an
indented line when you click the expander. However, if you click the
underlined property name link, instead of displaying the sample parameters
collection, the program hits an unhandled exception after walking the
property list of the first member of the inner collection once.
This is the error:
An unhandled exception of type 'System.Reflection.TargetInvocationException'
occurred in system.dll
Additional information: Property accessor 'SampleID' on object
'DAQ_LIMS_OBJ.CSampleParam' threw the following exception:'Object does not
match target type.'
The first question I have is: Is there some hand-off code the needs to be
in place to support Heirarchical data sets in DataGrids that wasn't covered
by the original article? The code works great with a "flat" collection.
Second question: Where can I find a book that covers how all these things
work (esp. the Framework stuff) Every book I've got covers basic
programming topics and C# language features but rarely addresses tricky stuff
like this. The online help is nearly worthless as it seems to consist only
of F1 (context) helps and random articles...where's the Programmer's guide
and reference? Where's the comprehensive framework docs?
Thanks in advance for any help you can offer.
I was trying to apply databinding to a custom collection as in the MSDN
Magazine article found in the August, 2005 issue. After converting the code
in the article to C# and applying it to an existing set of classes, I tried
using the collection as the datasource for a standard DataGrid control. The
problem is that the collection contains a collection as one of it's member
properties (ie. SampleCollection contains a SampleParameterCollection). The
DataGrid control seems to correctly detect that a heirarchy exists as it
displays the expander "[+]" and shows the name of the inner collection on an
indented line when you click the expander. However, if you click the
underlined property name link, instead of displaying the sample parameters
collection, the program hits an unhandled exception after walking the
property list of the first member of the inner collection once.
This is the error:
An unhandled exception of type 'System.Reflection.TargetInvocationException'
occurred in system.dll
Additional information: Property accessor 'SampleID' on object
'DAQ_LIMS_OBJ.CSampleParam' threw the following exception:'Object does not
match target type.'
The first question I have is: Is there some hand-off code the needs to be
in place to support Heirarchical data sets in DataGrids that wasn't covered
by the original article? The code works great with a "flat" collection.
Second question: Where can I find a book that covers how all these things
work (esp. the Framework stuff) Every book I've got covers basic
programming topics and C# language features but rarely addresses tricky stuff
like this. The online help is nearly worthless as it seems to consist only
of F1 (context) helps and random articles...where's the Programmer's guide
and reference? Where's the comprehensive framework docs?
Thanks in advance for any help you can offer.