473,406 Members | 2,208 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,406 software developers and data experts.

creating drop down list at run time

hi

I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the
items like 50,60,70,80,90,100.

i will select any skill in 1st drop down list then i'll select % of this
skill in the 2nd list box , based on the percentage i've selected in the 2nd
list box it has to display
2 sets of drop down list boxes at run time one for selecting skill and
another for selecting percentage of
skills it has to display these listboxes at run time upto total
percentage becomes 100.for e.g if i select java in 1st list
box and 60 in second list box then at run time below these 2 list boxes it
has to display another set of drop down lists. where i can select another
skill and for this skill i'll
select percentage.and i've to check the percentages
i've selected till now to know whether it has reached 100 %, if not i've to
disaply another set of drop down list boxes.

Hope you got what i said.

so for this wat i thought is to create dropdown list at run time.is it
possible to create drop down list at run time with the items.

can any one tell me how to add items to a drop down list which is created
at runtime.and how to get the value which i have selected in the drop down
list.am using html table on which am placing these controls.
each row in a table is having one control.

so if i want to create drop down list

control at run time i've to place it

for e.g. the 2 drop down list boxes are present at 3 row.and i've to
display newly created ones at 4rth row and so on.so i've to insert table row
at run time so that i can place newly created drop down list boxes on
this.can anybody tell me how to do this one.

Nov 19 '05 #1
2 12582
Hi Yoshitha,

You can put your First Dropdown list set in a Panel.
On SelectedIndexChange of the first drop down you can check the % value and
if <100 create a new <td> using LiteraControl, add it to the Panel and then
add your drop down list which is created dynamically.
For example:
DropDownList temp = new DropDownList();
temp.ID = "temp";

temp.Items.Add("10 % ");
temp.Items.Add("20 %");
temp.Items.Add("30 %");
temp.Items.Add("40 %");
temp.Items.Add("50 %");
temp.Items[0].Value = "10";
temp.Items[1].Value = "20";
temp.Items[2].Value = "30";
temp.Items[3].Value = "40";
temp.Items[4].Value = "50";

On checking the condition you can add the following code which will add <td>
and Drop down list to your panel.

Literal td_start = new Literal();
td_start.Text = "<td valign=top>";
panel1.Controls.Add(td_start);

panel1.Controls.Add(temp);

Literal td_end = new Literal();
td_end.Text = "</td>";
panel1.Controls.Add(td_end);

Hope this will help u.
Meena.

"Yoshitha" <gu**********@rediffmail.com> wrote in message
news:OC**************@TK2MSFTNGP15.phx.gbl...
hi

I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100.

i will select any skill in 1st drop down list then i'll select % of this
skill in the 2nd list box , based on the percentage i've selected in the 2nd list box it has to display
2 sets of drop down list boxes at run time one for selecting skill and
another for selecting percentage of
skills it has to display these listboxes at run time upto total
percentage becomes 100.for e.g if i select java in 1st list
box and 60 in second list box then at run time below these 2 list boxes it
has to display another set of drop down lists. where i can select another
skill and for this skill i'll
select percentage.and i've to check the percentages
i've selected till now to know whether it has reached 100 %, if not i've to disaply another set of drop down list boxes.

Hope you got what i said.

so for this wat i thought is to create dropdown list at run time.is it
possible to create drop down list at run time with the items.

can any one tell me how to add items to a drop down list which is created
at runtime.and how to get the value which i have selected in the drop down list.am using html table on which am placing these controls.
each row in a table is having one control.

so if i want to create drop down list

control at run time i've to place it

for e.g. the 2 drop down list boxes are present at 3 row.and i've to
display newly created ones at 4rth row and so on.so i've to insert table row at run time so that i can place newly created drop down list boxes on
this.can anybody tell me how to do this one.

Nov 19 '05 #2
Hi Yoshitha,

You can put your First Dropdown list set in a Panel.
On SelectedIndexChange of the first drop down you can check the % value and
if <100 create a new <td> using LiteraControl, add it to the Panel and then
add your drop down list which is created dynamically.
For example:
DropDownList temp = new DropDownList();
temp.ID = "temp";

temp.Items.Add("10 % ");
temp.Items.Add("20 %");
temp.Items.Add("30 %");
temp.Items.Add("40 %");
temp.Items.Add("50 %");
temp.Items[0].Value = "10";
temp.Items[1].Value = "20";
temp.Items[2].Value = "30";
temp.Items[3].Value = "40";
temp.Items[4].Value = "50";

On checking the condition you can add the following code which will add <td>
and Drop down list to your panel.

Literal td_start = new Literal();
td_start.Text = "<td valign=top>";
panel1.Controls.Add(td_start);

panel1.Controls.Add(temp);

Literal td_end = new Literal();
td_end.Text = "</td>";
panel1.Controls.Add(td_end);

Hope this will help u.
Meena.

"Yoshitha" <gu**********@rediffmail.com> wrote in message
news:OC**************@TK2MSFTNGP15.phx.gbl...
hi

I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100.

i will select any skill in 1st drop down list then i'll select % of this
skill in the 2nd list box , based on the percentage i've selected in the 2nd list box it has to display
2 sets of drop down list boxes at run time one for selecting skill and
another for selecting percentage of
skills it has to display these listboxes at run time upto total
percentage becomes 100.for e.g if i select java in 1st list
box and 60 in second list box then at run time below these 2 list boxes it
has to display another set of drop down lists. where i can select another
skill and for this skill i'll
select percentage.and i've to check the percentages
i've selected till now to know whether it has reached 100 %, if not i've to disaply another set of drop down list boxes.

Hope you got what i said.

so for this wat i thought is to create dropdown list at run time.is it
possible to create drop down list at run time with the items.

can any one tell me how to add items to a drop down list which is created
at runtime.and how to get the value which i have selected in the drop down list.am using html table on which am placing these controls.
each row in a table is having one control.

so if i want to create drop down list

control at run time i've to place it

for e.g. the 2 drop down list boxes are present at 3 row.and i've to
display newly created ones at 4rth row and so on.so i've to insert table row at run time so that i can place newly created drop down list boxes on
this.can anybody tell me how to do this one.

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Gurry | last post by:
Hi there I would like to write a javascript function that creates a drop-down list dynamically. I read on the docs that most HTML controls can not be created on run-time. what kind of...
4
by: Dan | last post by:
Can anyone offer suggestions on how to do this or if it is possible? I have a form that uses a drop down box and 2 text fields. What I am trying to do is have the value of each text box set by...
1
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
3
by: Don Wash | last post by:
Hi There! I have a Server-side Drop-down box in ASP.NET (VB) page. What do I do to widen the Drop down box's Pull-Down list's width? I'm not talking about the Drop-down box's width but the box...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
8
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
9
by: Tarscher | last post by:
hi all, I have this seemingly simple problem. I have lost a lot of time on it though. When a user selects a value from a dropdownlist (static control) a dynamic control is generated. I have...
1
by: student2008 | last post by:
Sorry about the title its a tricky one. I have a form which allows me to add a question and answers into a mysql database via a combination of, if a certain option is chosen and the reset button...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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...

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.