473,721 Members | 2,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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="garmentRepe ater" runat="server" OnItemCommand=" Repeater_Button Click"><HeaderT emplate><asp:La bel id="Label1" style="Z-INDEX: 101; LEFT: 250px; POSITION: absolute; TOP: 80px" runat="server
Width="200px" Height="50px" Font-Names="Impact" Font-Size="Large">Ga rments on offer</asp:Label></HeaderTemplate> <ItemTemplate>< table><tr><td
// this control is irrelevan
<asp:Button id="Button" runat="server" title = '<%# DataBinder.Eval (Container.Data Item, "Name") %>' text = "Select" /
// this control is irrelevan
<IMG id = "Image" src = '<%# DataBinder.Eval (Container.Data Item, "ImagePath" ) %>'/
// this control IS Relevant to my proble
<asp:DropDownLi st ID = "DropDownColour " DataSource = '<%# DataBinder.Eval (Container.Data Item, "Colours")% >'></asp:DropDownLis t></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.A dd("White")
colours.Items.A dd("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 4008
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
2365
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 from a dropdown on the page, is the state (contents) of the repeater and arraylist maintained (maybe the ViewState handles this?) ? Or do I need to re-populate the arraylist and bind the data again to the repeater?
0
1333
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 get an error stating that there were multiple controls with the same id. The stack trace shows the following: System.Web.UI.Control.BuildProfileTree(String parentId, Boolean
7
5485
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 Repeater control, I've placed DropDownLists and CheckBoxes. When the user has updated the information, he/he clicks the submit button which is outside the scope of the Repeater control.
2
5910
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... ArrayList arrStuff = (ArrayList)rptStuff.DataSource; but this comes back as null. I bound the repeater to an ArrayList when the page first loaded.
3
2111
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> <%# DataBinder.Eval(Container.DataItem, "question")%> </td></tr> <tr><td>
2
1907
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 to work just fine, as long as it's not nested within the first repeater. If it is nested within the first repeater, I don't get any data. If I put the second repeater as a separate repeater, not nested, it works fine. Here's my actual code,...
0
1585
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 of the items will have a value that was previously selected by the user. When the data is displayed, the previously selected values must be set as the default in the drop down. The ids of each drop down are created acording to their index in...
9
4688
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> /asp:Repeater> The DataSource for this Repeater is a CollectionBase of objects and is
2
3712
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 related to the row. I can't find a good control for this in ASP.Net 2.0. Now I use a repeater and check the checkbox on ItemDataBound, I also fill the dropdown on this event. My first problem is that i find this event very messy. I have to cast...
0
8840
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9367
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9064
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8007
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.