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

  • Thread starter Thread starter Guest
  • Start date Start date
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"
 
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.
 
Back
Top