473,769 Members | 4,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating dropdown dynamically

41 New Member
Hi,

I have an arraylist(al) in which I have some values. I want to populate these values in my dropdown list. I have used the following code

Expand|Select|Wrap|Line Numbers
  1. <select name="select">
  2. <%for(int i=0;i<al.size();i++){%>
  3. <Option value="<%al.get(i);%>"><%=al.get(i)%></Option>
  4. <%}%>
  5. </select>
I gets populaated but when i want to print its value it shows blank.
Can anybody tell me the reason and some other alternative to populate the dropdown so that i can get the selected value.

Thanks
Oct 26 '07 #1
1 1602
acoder
16,027 Recognized Expert Moderator MVP
How are you printing the value?
Oct 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2591
by: Lamine Darbouche | last post by:
Can anybody help? I need to have three list boxes automatically populating each other, (ie when region is selected from the first listbox, it will populate automatically the second one which is the TOWNS and when the town is selected is should populate the third one AREA) all data is in the database in one table. Any idea??? Many thanks in adavance. Lamine
1
1773
by: Mike P | last post by:
I am populating a drop down column in a datagrid on page load. Here is my code : <asp:TemplateColumn> <ItemTemplate> <asp:DropDownList ID="ddlUserName" Font-Name="Verdana" Font-Size="8pt" Runat=server DataValueField="UserName" DataTextField="UserName" DataSource='<%# GetUserList() %>'>
9
7042
by: netasp | last post by:
hi all, how can I populate one aspx form when page is loading based on page ID? for example: loading page A (to search for VB code) would display labels and texboxes, dropdown lists all related to VB, plus the address bar would show something like this: www.somethinghere?id=3 and if you change number 3 from the address bar to (for example) 34 or 71 you would get different page with the same formatting like I.e: www.somethinghere?id=34...
0
1706
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my SQL statements in the Data Acess Layer to create more secure web service application. The Web service class is also in the Data Access Layer. I need to populates the 4 Dropdown list boxes on the web form from one table. I have Customer table which...
7
17958
by: itgaurav198 | last post by:
Hi, I have an arraylist(al) in which I have some values. I want to populate these values in my dropdown list. I have used the following code <select name="select"> <%for(int i=0;i<al.size();i++){%> <Option value="<%al.get(i);%>"><%=al.get(i)%></Option> <%}%> </select>
4
1756
parshupooja
by: parshupooja | last post by:
Hey All, I have a dropdown on my page. I want to populate dropdown dynamically via code. Here is a scenario. for each year it should populate items automatically. such as most current item it should have is "Q4/2007" . Every year moving forward it shuld add items itself such as in jan 2008 it should automtically add "Q1/2008" and in april " Q2/2008" and so on I want item from most recent till Q1/2005. I have tried witing this, but than...
1
2175
by: redgoals | last post by:
Hi, I have searched the forum for a similar problem but have been unable to find anything. What i am trying to achieve is a dropdown menu which behaves in the following way: 1, Someone selects an category from the first dropdown menu 2, if the category has subcategories then dynamically create a new dropdown underneath and in the process fill it with the subcategories from the chosen option in the first menu. 3, keep doing the above...
2
1342
by: Shikha1234 | last post by:
Hi, I have two dropdowns. I want that the DDL2 gets populated based on the values in DDL1. How can I achieve that. This is the way I am populating DDL1 string cmd = "Select * from abc "; SqlDataAdapter da = new SqlDataAdapter(cmd, connection);
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8870
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...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
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
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.