bringing the value to the top in the drop down list.

G

Guest

Greetings people,

I have a drop down list with populates with a list of countries... and i want to add a new value to that drop down list call "<New>" the problem is, it keeps staying at the bottom of the page. how can i bring this value up? below are my codes, plz help meout. thanks.


'Query for the country and bind it to the drop down list.
cboCountry.DataSource = objCountry.GetCountry()
cboCountry.DataValueField = "CountryCode"
cboCountry.DataTextField = "Country"
cboCountry.DataBind()
cboCountry.Items.Add(New ListItem("<New>", "New"))
cboCountry.SelectedValue = "New"
 
M

Martin Marinov

You have to use Insert method ofListItemCollection instead of Add method.
the syntax of Insert is
Overloads Public Sub Insert(Integer, ListItem)

Regards
Martin

Asha said:
Greetings people,

I have a drop down list with populates with a list of countries... and i
want to add a new value to that drop down list call "<New>" the problem is,
it keeps staying at the bottom of the page. how can i bring this value up?
below are my codes, plz help meout. thanks.
 

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

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top