Repeater itemdatabound event value type and reference type

Posted by Sune on Stack Overflow See other posts from Stack Overflow or by Sune
Published on 2010-03-29T13:59:56Z Indexed on 2010/03/29 14:03 UTC
Read the original article Hit count: 457

Filed under:
|
|

Im trying to bind a list with datetime objects to my repeater.

if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { DateTime actualDate = e.Item.DataItem as DateTime; }

When I want access the itemdatabound event on the repeater Then I get an errormessage which says that DateTime is a valuetype and not a reference type. My solution is that a wrap the datetime in a custom object (reference type) and pass that to the repeater datasource instead of the datetime. But Im wondering if there are other solutions where the repeater takes valuetypes (DateTime objects)........

© Stack Overflow or respective owner

Related posts about repeater

Related posts about itemdatabound