472,958 Members | 2,215 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 12538
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.