A
A Traveler
Hello, i have a control inheriting from the DataRepeater control. It has a
property which is the name of a Column/Property to run subtotals on from the
datasource; this is stored in pSumColumn As String. I have an OnItemCreated
handler.
Now, in my project, i have a LineItemsCollection class which is a
strongly-typed collection of LineItem objects. The LineItemsCollection class
inherits from
System.Collections.Specialized.NameObjectCollectionBase, and implements
IEnumerator and IList.
In my ItemCreated handler, when i try to do DataBinder.Eval(e.Item.DataItem,
pSortColumn) it tells me that "System.String" does not have a property
"Quantity" (assuming pSumColumn = "Quantity"). I dont understand why it is
trying to access e.Item.DataItem as a string, instead of as the type of
object it really is (in this case, a LineItem). The value it is pulling for
the String of it though is actually the value of one of the other properties
of the LineItem class.
I had problems like this when first doing my collection class and trying to
bind a datagrid to it, i couldnt access item properties. But this was fixed
after implementing, as id read, the IList interface.
How can i get e.Item.DataItem to reflect the proper object type???
Thanks in advance.
- Arthur Dent
property which is the name of a Column/Property to run subtotals on from the
datasource; this is stored in pSumColumn As String. I have an OnItemCreated
handler.
Now, in my project, i have a LineItemsCollection class which is a
strongly-typed collection of LineItem objects. The LineItemsCollection class
inherits from
System.Collections.Specialized.NameObjectCollectionBase, and implements
IEnumerator and IList.
In my ItemCreated handler, when i try to do DataBinder.Eval(e.Item.DataItem,
pSortColumn) it tells me that "System.String" does not have a property
"Quantity" (assuming pSumColumn = "Quantity"). I dont understand why it is
trying to access e.Item.DataItem as a string, instead of as the type of
object it really is (in this case, a LineItem). The value it is pulling for
the String of it though is actually the value of one of the other properties
of the LineItem class.
I had problems like this when first doing my collection class and trying to
bind a datagrid to it, i couldnt access item properties. But this was fixed
after implementing, as id read, the IList interface.
How can i get e.Item.DataItem to reflect the proper object type???
Thanks in advance.
- Arthur Dent