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!

dropdownlist selectedindex incorrect

Status
Not open for further replies.

rambleon

Programmer
Mar 6, 2004
130
IL
Hi,
I have a dropdown list with 6 items, no matter which one of the items I click the SelectedIndex changes to 1.
Any ideas?
 
I'm going to take a guess that you want the ASP.Net forum. VB.Net uses combo boxes.

That said, I'm going to take a wild guess that you should look in your page load event and see if you are binding or loading the drop down list there. if so, put that code in a if not page.ispostback block.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Rick,
The loading and binding is in a - If Not Page.IsPostback block.
The code only works for the 1st and 2nd items in the list (SelectedIndex = 0 or 1)
 
I would double check your code and make sure that nothing else is setting the selected index and that the combo box maintains state.

If that all checks out, I'd say head over to the ASP.Net forum and see if they can help you.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Rick could you please expand on 'maintains state', I'm new to this.
I've posted the code in the asp.net forum if you're intrested.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top