473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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"
Nov 18 '05 #1
1 971
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" <As**@discussions.microsoft.com> wrote in message
news:6A**********************************@microsof t.com...
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"

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dan | last post by:
This is one that has me stumped and I need an expert's input. Any ideas why the values from the second script-generated drop down list isn't recognized by the script to add time values to the...
1
by: Asha | last post by:
greetings, i populate my drop down list from the db and i wanto add a new value to it call <NEW>. but this new always sits and the bottom. how can i bring this value all the way to the top? thanks...
3
by: pmud | last post by:
Hi, I have a drop down list bound to a database thorugh a data reader. It reads the customer names from data reader. Now, I want the user to be able to type more than one alphabet & the list...
4
by: Martyn Fewtrell | last post by:
I want to update a database record with a number of fields - doesn't sound to difficult at this stage! I have a system to select the correct record from the database and load the data into a...
3
by: Mike Collins | last post by:
I'm not feeling too smart right now, but I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. Can someone show...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
2
by: Ren | last post by:
Hi all, I am a bit new to PHP and SQL so this may seem like a dumb question. I have already created a drop down list as part of a form which is automatically populated with values taken from a...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.