Repeater, create dropdown bound to arraylist

G

Guest

I have an arraylist of objects. This arraylist is bound to a repeater. That repeater then creates a set of controls like so

<asp:repeater id="garmentRepeater" runat="server" OnItemCommand="Repeater_ButtonClick"><HeaderTemplate><asp:Label id="Label1" style="Z-INDEX: 101; LEFT: 250px; POSITION: absolute; TOP: 80px" runat="server
Width="200px" Height="50px" Font-Names="Impact" Font-Size="Large">Garments on offer</asp:Label></HeaderTemplate><ItemTemplate><table><tr><td
// this control is irrelevan
<asp:Button id="Button" runat="server" title = '<%# DataBinder.Eval(Container.DataItem, "Name") %>' text = "Select" /
// this control is irrelevan
<IMG id = "Image" src = '<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>'/
// this control IS Relevant to my proble
<asp:DropDownList ID = "DropDownColour" DataSource = '<%# DataBinder.Eval(Container.DataItem, "Colours")%>'></asp:DropDownList></td></tr></table></ItemTemplate></asp:repeater

Now you can see from this I am trying to create a drop down list which has the contents of an arraylist that is part of the type of object in the arraylist that the repeater is bound to

e.g:(psuedocode

Garment g = new Garment()
g.Name = "Some name"
g.ImagePath = "Image1.jpg"
ArrayList colours = new ArrayList()
colours.Items.Add("White")
colours.Items.Add("Black")
g.Colours = colours

ArrayList myObjects = new ArrayList()
myObjects.Add(g)
garmentRepeater.DataSource = myObjects
DataBind()

As you can see the arraylist that the repeater is bound to contains objects which contain arraylists as well. Is it possible to bind these to a dropdownlist while the repeater is creating them

Many thanks to anyone who read this far or gifts me with a reply

Jax
 
G

Guest

Solved it in a bit of a roundabout route
Added to each drop down a made up tag which contained the garment name
Then after databinding, searched through the controls to get the drop down lists. Then compared the made up tag to each garment item name, if it matched I set the arraylist
awesome

jax
 

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

Top