Dropdownlist Error

T

TJHerman

I have a dropdown list that keeps making my page error out with the following
message:

"'DropDownList1' has a SelectedValue which is invalid because it does not
exist in the list of items.
Parameter name: value "

The problem is that I've got existing data whose items are not included in
the updated list of options. For example, my dropdownlist has a static list
of 5 values. The problem seems to be that if I choose to view an existing
record that has a value of "Quality" in the Product field (which the
dropdownlist is bound to) and "Quality" is not one of the 5 values in the
dropdownlist, I get the error and the page won't even build. As soon as I
change this value to one of the 5 provided values, the error goes away.

I thought that one time before I fixed this problem by setting the property
AppendDataBoundItems to True but this is not working for this field now. It
is bound to a field in the sqldatasource but I've also tried hard-coding the
items manually with HTML.

Do I need to put some code in the databound event for the dropdownlist and
if so, does anyone know what that should look like? (I'm using VB.)
 

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

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top