Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving a dropdownlist member (1.1) 1

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
I have a dropdownlist that is populated from a sqldatareader - I am then adding in a "None Selected" after binding the data so it shows at the bottom - How can I move it to the top?

[conehead]
 
mydropdown.Items.insert(0,"None Selected")
mydropdown.Selectedindex = 0

-DNG
 
Hmmm does not seem to work - could this be a 2.0 vs. 1.1 issues? I am using 1.1...

I am adding the new item via:

Code:
mydropdown.Items.Add(new ListItem("text", "value"));

if that helps....

[conehead]
 
try this:

mydropdown.Items.Insert(0, new ListItem("None Selected"))

-DNG
 
Ive always used:

Code:
mydropdownlist.DataBind()
mydropdownlias.Items.Insert(0,"None Selected")

And its always worked for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top