How can I get all the data in dropdownlist?
For specific data, I encode: Dropdownlist.selecteditem.text. But how can I get all the data?
Thanks in advance.
Hi,
Create a loop that runs through the dropdownlist items. Like so:
for(int i = 0; i < dropdownlist.items.count; i++) {
// access each item and do something with it via
// dropdownlist.items[i].ToString() or whatever suits
}
Hope that helps,
If you are planning to put them to an array.
dropdownlist.Items.CopyTo(SomeArray,0)
' First argument, the array. Second is the index of the array.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.