Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DropDownList Problem

Reply
Thread Tools

DropDownList Problem

 
 
Lou Civitella
Guest
Posts: n/a
 
      12-20-2006
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


 
Reply With Quote
 
 
 
 
David Wier
Guest
Posts: n/a
 
      12-20-2006
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

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com



"Lou Civitella" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      12-21-2006
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.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


"Lou Civitella" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DropDownList inside GridView: How to set SelectedIndex for the DropDownList? keithb ASP .Net 1 11-01-2006 05:24 AM
GridView: Filter DropDownList for another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-29-2005 07:44 AM
GridView: Filtr DropDownList from another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-23-2005 01:31 PM
databinding a Dropdownlist to another dropdownlist tshad ASP .Net 8 10-19-2005 10:00 PM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM



Advertisments