469,573 Members | 1,706 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,573 developers. It's quick & easy.

Repeater, create dropdown bound to arraylist

Jax
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"><HeaderTempla te><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
Nov 15 '05 #1
1 3837
Jax
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
Nov 15 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Peter Kirk | last post: by
reply views Thread by Mike K | last post: by
7 posts views Thread by charliewest | last post: by
2 posts views Thread by Alan Silver | last post: by
3 posts views Thread by Andrew | last post: by
2 posts views Thread by mark | last post: by
2 posts views Thread by RichardH | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.