DropDownList selected value error

D

David C

I have a DropDownList control that is bound to a string data field
(varchar(3)) that contains Null, 'yes', 'no', or 'n/a'. One of the records
in the database had a value of Yes and it gave an error

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

I take it a capital Y is considered different than a lower case y. Is there
a workaround short of me updating all of the columns to lower case? Thanks.

David
 
G

Guest

I have a DropDownList control that is bound to a string data field
(varchar(3)) that contains Null, 'yes', 'no', or 'n/a'. One of the records
in the database had a value of Yes and it gave an error

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

I take it a capital Y is considered different than a lower case y. Is there
a workaround short of me updating all of the columns to lower case? Thanks.

David

Hi, David

to return a string in lowercase letters you could use

in SQL: select LOWER(datafield)....
in .NET: stringvalue.ToLower()

Hope this helps
 

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,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top