473,762 Members | 7,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Any good solutions for: SelectedValue which is invalid because it does not exist in the list of items?

Just trying to get multiple dropdowns's to work inside another control
(details view)
I'm seeing this error, but not consistantly. I can even cut and paste a
working set of controls into a new page, and somtimes it works and other
times it throws this error.

I'm sure this has come up before but I didn't see it in the history. Also,
the solutions I have found on the web are pretty old.
This is driving me crazy.
Jul 14 '08 #1
4 3145
Make sure that every ddl has its own collection of items. Even if the items
are the same, you need to have a separate copy of them for every ddl.

It may be not the culprit in your case, hard to say without seeing the code.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"randy.buchholz " <ra************ @dads.state.tx. uswrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
Just trying to get multiple dropdowns's to work inside another control
(details view)
I'm seeing this error, but not consistantly. I can even cut and paste a
working set of controls into a new page, and somtimes it works and other
times it throws this error.

I'm sure this has come up before but I didn't see it in the history.
Also, the solutions I have found on the web are pretty old.
This is driving me crazy.
Jul 14 '08 #2
Thanks Eliyahu,
Would have put code if there was any not generated. It can be reproduced
through dragging and dropping.
I put a details view on the page, convert several fields to template fields
and start adding databound ddl's to the fields. When I add new ddl and run
the page it will work. As I continue to add ddl's at some point it throws
the error. Once this eror shows, even if I remove the last (or other) ddl
(returing to a previously working state) the error persists.

Confirmed every ddl had its own source/dataset.

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:e9******** ******@TK2MSFTN GP02.phx.gbl...
Make sure that every ddl has its own collection of items. Even if the
items are the same, you need to have a separate copy of them for every
ddl.

It may be not the culprit in your case, hard to say without seeing the
code.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"randy.buchholz " <ra************ @dads.state.tx. uswrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>Just trying to get multiple dropdowns's to work inside another control
(details view)
I'm seeing this error, but not consistantly. I can even cut and paste a
working set of controls into a new page, and somtimes it works and other
times it throws this error.

I'm sure this has come up before but I didn't see it in the history.
Also, the solutions I have found on the web are pretty old.
This is driving me crazy.

Jul 15 '08 #3
Analyze carefully the sequence of events. See when the ddls get populated
and when the code is attempting to use the selected value. The likely reason
for the exception is the code wants the value before the ddls get their
items.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"randy.buchholz " <ra************ @dads.state.tx. uswrote in message
news:uz******** ******@TK2MSFTN GP06.phx.gbl...
Thanks Eliyahu,
Would have put code if there was any not generated. It can be reproduced
through dragging and dropping.
I put a details view on the page, convert several fields to template
fields and start adding databound ddl's to the fields. When I add new ddl
and run the page it will work. As I continue to add ddl's at some point
it throws the error. Once this eror shows, even if I remove the last (or
other) ddl (returing to a previously working state) the error persists.

Confirmed every ddl had its own source/dataset.

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:e9******** ******@TK2MSFTN GP02.phx.gbl...
>Make sure that every ddl has its own collection of items. Even if the
items are the same, you need to have a separate copy of them for every
ddl.

It may be not the culprit in your case, hard to say without seeing the
code.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"randy.buchhol z" <ra************ @dads.state.tx. uswrote in message
news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
>>Just trying to get multiple dropdowns's to work inside another control
(details view)
I'm seeing this error, but not consistantly. I can even cut and paste a
working set of controls into a new page, and somtimes it works and other
times it throws this error.

I'm sure this has come up before but I didn't see it in the history.
Also, the solutions I have found on the web are pretty old.
This is driving me crazy.


Jul 16 '08 #4
Yes, from what I have read about this issue this is essentially the problem.
The issue as I understand it is that there a sequence of calls within the
ddl processing and two of the calls are back-to-back inside the control.
There is no way to capture an event or error between these calls, so if the
first call provides bad or incomplete data the second call is still
executed, generating the error. I believe this is in the space between
databinding and databound. There a few nasty work-arounds and one that is
not so bad - creating a custom ddl control that overrides the binding
processes. I was hoping someone here may have heard of a better solution.

The problem with the solutions is tied to an in-house problem. I am the
only one in our organization that has any non-COBOL experience in the org,
and trying to teach COBOL programmers OO concepts is proving dificult. I'm
still a nub myself with less than 1 yr exp in .Net/C# or web/html. Haven't
programmed in a while, spent the last 30 years in management and decided to
get back to building things (but it seems there is no great demand for
Fortran developers :)). Anyway, I degress. Bottom line is I am trying to
stick to out-of the-box approaches right now for if I make things anymore
complex than that I will end up having to do support as well as development.

Thanks

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:Oh******** ******@TK2MSFTN GP05.phx.gbl...
Analyze carefully the sequence of events. See when the ddls get populated
and when the code is attempting to use the selected value. The likely
reason for the exception is the code wants the value before the ddls get
their items.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net
"randy.buchholz " <ra************ @dads.state.tx. uswrote in message
news:uz******** ******@TK2MSFTN GP06.phx.gbl...
>Thanks Eliyahu,
Would have put code if there was any not generated. It can be reproduced
through dragging and dropping.
I put a details view on the page, convert several fields to template
fields and start adding databound ddl's to the fields. When I add new
ddl and run the page it will work. As I continue to add ddl's at some
point it throws the error. Once this eror shows, even if I remove the
last (or other) ddl (returing to a previously working state) the error
persists.

Confirmed every ddl had its own source/dataset.

"Eliyahu Goldin" <RE************ **************@ mMvVpPsS.orgwro te in
message news:e9******** ******@TK2MSFTN GP02.phx.gbl...
>>Make sure that every ddl has its own collection of items. Even if the
items are the same, you need to have a separate copy of them for every
ddl.

It may be not the culprit in your case, hard to say without seeing the
code.

--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
"randy.buchho lz" <ra************ @dads.state.tx. uswrote in message
news:%2****** **********@TK2M SFTNGP03.phx.gb l...
Just trying to get multiple dropdowns's to work inside another control
(details view)
I'm seeing this error, but not consistantly. I can even cut and paste
a working set of controls into a new page, and somtimes it works and
other times it throws this error.

I'm sure this has come up before but I didn't see it in the history.
Also, the solutions I have found on the web are pretty old.
This is driving me crazy.




Jul 16 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7297
by: Jay | last post by:
On my aspx page I have a FormView with a RadioButtonList bound to a column on a DataSource table. The form starts up in Edit mode. I want the formView to start up with nothing yet selected in the RadioButtonList. Is there a way to do this? With null in the table/column, I get a startup error complaining the SelectedValue is invalid because it does not exist in the list of items. Thanks very much if someone has a way to solve this...
6
3933
by: blouie | last post by:
Is there a way that a bound ddl control can: 1. display the bound data, even if it does not match a selection in the DDL? 2. allow the user to enter something other than the look up values? I have a bound dropdown list that retrieves it's selections from a look-up table. The DDL is bound to a database table and unless the value in the (text) field matches one of the look-up values, the page craps out.
0
1029
by: David C | last post by:
I have a web page with a dropdownlist which uses a SqlDatasource and a SelectCommand to show selections from a table. However, when I postback (going into Edit mode) on a FormView I get the error "'ddlGroups' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value" I am changing the options in the page_load as follows: Select Case txtGroup.Text
2
9959
by: sree reddy | last post by:
..cs using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls;
2
7155
by: DesCF | last post by:
I have a textbox and a combobox on a toolstrip. The user enters either an ID in the textbox or selects a name from the combobox. When the user selects a name from the combobox the textbox is filled in automatically by setting its .Text property equal to the .SelectedValue of the combobox. When the user enters an ID in the textbox the combobox's .SelectedValue is set to the .Text value in the ID textbox. All works fine but it is ...
1
2003
by: =?Utf-8?B?TWFoZXNoIE5pbWJhbGthcg==?= | last post by:
On my page, I have ObjectDataSource and ListView. In Oninit method, I am setting selected value of Listbox. In above scenario, it throws error if I set SelectedValue property of ListBox and if that item does not exist in ListBox collection. "has a SelectedValue which is invalid because it does not exist " I want to suppress this error if that item to be have selected does not exist in collection.
18
4984
by: Ben | last post by:
Hi, i dynamically feed a dropdownlist which value from 1 to 20. That dropdownlist is bound to field 'wa' (type nvarchar(4)) in 'mytable'. There are 4 records and the values of field 'wa' are: 2 3 1 4. All those values are contained in the list of items of the DD. In normal mode, the field 'wa' appears for each record with the right value. When i click on the Edit button, i get this error: "DropDownList1' has a SelectedValue which is...
0
1117
by: randy.buchholz | last post by:
I am trying to trap the following error. I have tried to catch it on page load and every event on the data source and dd. No luck. I'm forcing the error by setting the dd.text to an invalid value on page load which seems to be when the exception is thrown. How can I trap it? Thanks. Exception Details: System.ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of...
1
4940
by: Brett | last post by:
I have a DropDownList in an ASP.NET web form that is populated with items from a lookup table by binding that DropDownList to a SqlDataSource. However, the items in the lookup table can change over time. The problem is that when an item has been removed from the lookup table, and a user wants to retrieve a record that used the deleted item, the following error occurs: 'ddlAssignedTo' has a SelectedValue which is invalid because it...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.