Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2007, 06:56 AM
Registered User
 
Join Date: Oct 2007
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invalid Selected Value

Hi

I'm hoping someone will be able to point me in the right direction.

I have a details view which pull information out of an sql database which a user can then update. All this is working fine, however now comes the bit I'm having difficulty with. Within the details view is a drop down list with a list of team names. Through a separate gridview a user can either update these team names or if the team is no longer part of the company it can be made in-active. If it has been made inactive that team is removed as an option from the drop down list.

Now what happens is if the team name has been made inactive and a user tries to edit a record via the details view with that team name associated with it I get the error TeamNameDropDownList has a SelectedValue which is invalid because it does not exist in the list of items. I understand why I'm getting this error, because the team name is no longer in the list of options but how do I get around it? I'm thinking of maybe some sort of if statement but not sure where to start?

Any help would be mucho appreciated

Thanks
 
Old October 31st, 2007, 07:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

well.. I can see a little flaw in your logic (IMHO), why can you inactive a team name that has related records active??

I thinking 2 solutions, one is to avoid putting inactive something that should be active (or that records are something like orphans??) the second is to move the childs records to another team.

what happends if I want to change the other info of the record (not the team name), but the team name is inactive???

I think that you have another kind of problem here...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old November 5th, 2007, 02:48 AM
Authorized User
 
Join Date: Jul 2007
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear RubyRue,
Try to bind the details view and the drop down list in the details view when ever you update a record in the gridview of the teams.

I hope this would help you.

Asmaa,






Similar Threads
Thread Thread Starter Forum Replies Last Post
% is an invalid character? owoade .NET Web Services 1 August 12th, 2007 12:32 PM
Invalid Object Name busybee ASP.NET 1.0 and 1.1 Professional 1 July 5th, 2006 11:13 PM
Invalid ServicedComponent jdang67 C# 2005 0 February 10th, 2006 12:36 PM
syntax error on <option selected="selected"> hamid HTML Code Clinic 1 October 13th, 2004 09:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.