473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Binding Repeater to custom object collection

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;

}
}
Nov 18 '05 #1
1 2641
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

"Weston Weems" <wweems@nospamdamnit_gmail.com> wrote in message
news:10*************@corp.supernews.com...
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;

}
}

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element...
2
by: A Traveler | last post by:
Hi, I have a custom collection class i wrote, LineItemsCollection, which is a strongly typed collection of objects of my LineItem class. The LineItem class is a simple class with just a couple...
2
by: Gastin | last post by:
I am consuming a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to...
1
by: Demetri | last post by:
Someone posted the following back in June and I am now doing the same thing. I'll just paste what was asked and see if anyone can give us an answer: ...
9
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate>...
8
by: fernandezr | last post by:
I would like to use a user control as a template inside a repeater. Some of the fields in the control should be hidden depending on whether or not there is data. I'm still a ASP .Net newbie so the...
3
by: cannontrodder | last post by:
I am displaying names and other details of my users in a Formview control by binding my custom business object to it. My custom object also has a property that is a collection of boolean values and...
6
by: Milsnips | last post by:
hi there, i have a page with a repeater that is populated with my function called GetList, that returns an arraylist of my custom object, lets say its called Products{ProductID, Description,...
5
by: DotNetNewbie | last post by:
Hi, It is not possible to bind a Generic.List collection to a repeater I guess huh? I am getting this error: An invalid data source is being used for rpCategories. A valid data source must...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.