473,378 Members | 1,333 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,378 software developers and data experts.

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 3975
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Peter Kirk | last post by:
Hi there I have a repeater which I bind to an arraylist (and the list is displayed on my page). The list is data fetched from a database. During a postback from another control, for example...
0
by: Mike K | last post by:
Hello, I have run into a strange situation. I have a control in which I am trying to sort the datasource of a repeater and bind the arraylist data back to the repeater. Whenever I do this I...
7
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
2
by: Alan Silver | last post by:
Hello, I am using a repeater on a page, and on postback would like to get hold of the ArrayList that I used to populate the repeater. I thought that I should be able to do something like... ...
3
by: Andrew | last post by:
Hi, I am working on a questionnaire. I have displayed a questionnaire using a repeater control. The itemtemplate is as below (quite cut down): <ItemTemplate> <tr><td> <%#...
2
by: mark | last post by:
(not sure if this is the correct group) My problem is I need to have a "nested" repeater. I have an array which I load into a hashtable - that part works great. I can setup the second repeater...
0
by: dutone | last post by:
I have searched high and low for a solution to this and I dont think its possible.... but I hope not. What I have is a list of items with various values that can be changed via a drop down. Each...
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>...
2
by: RichardH | last post by:
Hi, I have x number of table rows that all should have a checkbox and a dropdownlist on each row. The checkbox could be checked and the dropdown should contain y number of values that are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.