Solved

'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items.

Posted on 2011-09-06
2
272 Views
Last Modified: 2012-05-12
This is a question I'm seeing quite a bit and I'm not seeing a perfect fit answer. I've got a form with a series of dropdowns fed by sql datasources in an asp.net page. They pull from different tables.

The problem I've got it that if one of the items in my table gets "deactivated" from my list, it will spit out this error if  someone goes to look at an old record where it was picked.

I'm experiencing that very thing right now in a test. I'm looking for something quick and clean to either add the item/ ignore(?) the error and just not display a value/ a good rational solution.

"deactivated" = I only flag things as "deactivated" most of the time as opposed to deleting them. The table's not that big even with the "deactivated" records. My datasources filter these out.
0
Comment
Question by:jdcollins21
2 Comments
 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 36493411
I hope you are selecting data for the dropdown list from database using SP/query. However you include the WHERE deactivated=0 condition in that.
Now you would get only active items.
0
 

Author Closing Comment

by:jdcollins21
ID: 36494564
Thanks for your help. I woke up this morning with a similar idea. It works!
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now