Strange problem with dropdown list - always selects the first item

  • Thread starter Thread starter Vinay
  • Start date Start date
V

Vinay

Hi All:

I'm having a strange problem with the dropdownlist. Here is what is
happening:

I have a webform on which I have a whole bunch of controls. The form has 2
dropdownlists. The dropdowns are bound. The items are loaded just fine into
the dropdown lists at the time of page load. When I try to select an item
from the dropdown list, it always ends up selecting the first item.

1. I have set the autopost back to true
2. The selectedindexchanged event does not fire.

Does anyone have any idea what is happening?

Vinay
 
Hi Vinay

I believe you are using something like this
ddlSubActivity.SelectedIndex = ddlSubActivity.Items.IndexOf(ddlSubActivity.Items.FindByValue(cstrSubActivityValue)
I believe you are populating the dropdowns in same functions
If so , try to use the above code after you have bound the second dropdown also. do not do immediately after bindin
the first dropdow

Satish
 
Hi Vinay,

Show some code maybe we can help you than better.

Cor
 
Hi Satish/Cor:

Thanks for trying to help. The problem was in my code. I am binding the ddl
to an arraylist that consists of objects. The class defn for that object was
messed up which led up to this - a typo was the culprit!

Thanks again :)

Vinay
 

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

Back
Top