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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top