Binding Repeater to custom object collection

W

Weston Weems

I've got a collection of objects say fruit. and fruit has a fairly decent
heirachial structure not just flat props.

I've got my repeater to bind to my fruit collection just fine, but what I
want to do is actually be able to view specific properties in my repeaters
template.

Here's what I've got so far, which is being exectued for each row in the
repeater.
My problem is that for whatever reason I cant cast DataItem to Fruit. Can
anyone recommend an object of fruit type from my repeater?

protected string getFruitInfo(object DataItem,string propname){

Fruit currentfruit = (Fruit)DataItem;

switch(propname){
case "genus":
return currentfruit.this.that.genus;

}


}
 
W

Weston Weems

Ahh nevermind, I figured the problem was that I was casting to wrong
datatype, casting to a DictionaryEntry(no custom object collection was not
of my design...)

Thanks
Weston
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top