beginner ?

  • Thread starter Thread starter AussieRules
  • Start date Start date
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
 
think now you have to create a ListItem
and you then add the listitem to the items collection.
 
Dropdownlist1.Items.Add(new Listitem("text","value"));

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