Solved

Get all values from dropdown list with c#

Posted on 2008-06-23
3
1,584 Views
Last Modified: 2011-10-03
Hello

I need to retrieve all the text and  values in a dropdownlist using c#

Any Help is appreciated
0
Comment
Question by:charlesbaldo
3 Comments
 
LVL 16

Accepted Solution

by:
burakiewicz earned 500 total points
ID: 21848280
what do you need to store them as, you can loop through the collection
foreach (ListItem li in ddlItems.Items)
{
    string s =li.Text;
    string x=li.Value
}
0
 
LVL 9

Expert Comment

by:Rahul Goel ITIL
ID: 21848328

foreach (ListItem item in dropDown1.Items)
{
    Console.WriteLine(li.Text.ToString() + "," + li.Value.ToString());
}

Open in new window

0
 

Author Closing Comment

by:charlesbaldo
ID: 31469856
Perfect, Thanks for the quick response
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question