beginner ?

A

AussieRules

Hi,

In VB you can add an object to a combo such as

dim ob as object
ob.id = 1
ob.name = 'sample'
cbobox.items.add(ob)

These does not seem to work in asp.net.

How can I do this, I want to add object items into a dropdown, and when the
user selects an option I can get the id value. The name is no use to me, as
the administrator can change it based on there language.

Thanks
 
H

Hermit Dave

think now you have to create a ListItem
and you then add the listitem to the items collection.
 
A

Alvin Bruney [ASP.NET MVP]

Dropdownlist1.Items.Add(new Listitem("text","value"));

on selection
Dropdownlist.SelectedValue will be equal to "value"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top