Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-06
2
Medium Priority
?
282 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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Loops Section Overview
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

879 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