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

Iterate through static items in a dropdownlist

Do
Hi,

How do I read through the items that are statically set in a
dropdownlistbox?
Usually, I have my items in a dataset before I bind to a control, so I can
read the data.

But if they're set with the dropdownlist item tags, how do I read through
them
and their properties?

Do
Nov 18 '05 #1
3 8931
Hi,

you can loop through DropDownList's Items collection.

Dim litem As ListItem
For Each litem in DropDownList1.Items
'Do something
Next

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Do" <do*************@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I read through the items that are statically set in a
dropdownlistbox?
Usually, I have my items in a dataset before I bind to a control, so I can
read the data.

But if they're set with the dropdownlist item tags, how do I read through them
and their properties?

Do

Nov 18 '05 #2
Do
How do I do it for listbox items that are in a datagrid
on edit mode?
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:u4****************@tk2msftngp13.phx.gbl...
Hi,

you can loop through DropDownList's Items collection.

Dim litem As ListItem
For Each litem in DropDownList1.Items
'Do something
Next

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Do" <do*************@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I read through the items that are statically set in a
dropdownlistbox?
Usually, I have my items in a dataset before I bind to a control, so I can read the data.

But if they're set with the dropdownlist item tags, how do I read

through
them
and their properties?

Do


Nov 18 '05 #3
Do
How do I do it for listbox items that are in a datagrid
on edit mode?
"Teemu Keiski" <jo****@aspalliance.com> wrote in message
news:u4****************@tk2msftngp13.phx.gbl...
Hi,

you can loop through DropDownList's Items collection.

Dim litem As ListItem
For Each litem in DropDownList1.Items
'Do something
Next

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"Do" <do*************@hotmail.com> wrote in message
news:Oc**************@TK2MSFTNGP11.phx.gbl...
Hi,

How do I read through the items that are statically set in a
dropdownlistbox?
Usually, I have my items in a dataset before I bind to a control, so I can read the data.

But if they're set with the dropdownlist item tags, how do I read

through
them
and their properties?

Do


Nov 18 '05 #4

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

Similar topics

4
by: mb | last post by:
what is the best way to do this: In a game I want to a class called "Items". This class will have the game items public class Items { public int Chair public int Table . . .and so on . . .
4
by: Luis Esteban Valencia | last post by:
Hi Everyone, How do you get two or more listitems to have the same value? I am trying to do this: <asp:dropdownlist id="one" runat="server"> <asp:listitem text="hello" value="hi" />
1
by: Bob | last post by:
I've made an upload function saving to a specific folder and dropdownlist reading and listing files from the folder. When I upload, the list is rendered a second time in the dropdownlist with the...
2
by: dan_williams | last post by:
Without having to loop through all my items in a dropdownlist, is there an existing asp.net 1.1 function to populate a comma delimited string with the values of my dropdownlist? I'm sure it's...
3
by: TS | last post by:
we publish our exceptions to email at work and include the form's vlaues to help debug in production. Since the control wont' appear if it is empty, how can i access it to show the controls wiht a...
2
by: John Grandy | last post by:
Is it possible to bind a Dictionary to a DropDownList ? The most obvious code fails : Dictionary<string,stringdictionary = new Dictionary<string,string> dictionary.Add("Name1","Value1");...
2
by: Noah | last post by:
What is the fastest way to select N items at a time from a dictionary? I'm iterating over a dictionary of many thousands of items. I want to operate on only 100 items at a time. I want to avoid...
1
by: bogdan | last post by:
Hi, I'd like to use a dropdownlist in a formview to map numeric values to 'user-friendly' descriptions. The dropdownlist items' values need to be bound to a column in a db table. For example,...
1
by: mfaisalwarraich | last post by:
Hello, I am trying to match the values of a combo box which are typed inside a combo box with the comb box items, which are bind to a datasource. i can see the items in the combo box and if i get...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
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...
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,...

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.