DropDownList Problem

L

Lou Civitella

I have two drop down list boxes on my asp page. The boxes store a country
value on my page. They are filled by code during the load event and then I
set their values in code from a table on a SQL server. If the values are the
same then all is OK but if the values happen to be different I get this
error
Cannot have multiple items selected in a DropDownList.
I cannot fiugre out why this keeps happening. I have two other DropDownList
boxes on my page that show state information and they work correctly. I dont
have any code that sets the country fields to each other so I dont know
where the problem lies.

If any one has any suggestions that would be great as this problem is really
puzzling me.

Thanks In Advance,
Lou
 
D

David Wier

When you populate the dropdownlists in the Page_Load - make sure they're
surrounded by an if/then Postback block:
if Not Page.IsPostBack then
' populate lists
end if
 
E

Eliyahu Goldin

This may happen if two ddls share the same item collection. When you make
an item selected via one ddl, and the item is participating also in another
ddl, and another ddl already has some other item selected, than you get this
problem.
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top