473,770 Members | 4,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Has a SelectedValue which is invalid because it does not exist

On my page, I have ObjectDataSourc e 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.

I am thinking to hook DataBinding or Selected event of ObjectDataSourc e and
suppress error in that event. Could you please give example of those events
in this context?

--
Thanks,
Mahesh

Jun 27 '08 #1
1 2003


"Mahesh Nimbalkar" wrote:
On my page, I have ObjectDataSourc e 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.

I am thinking to hook DataBinding or Selected event of ObjectDataSourc e and
suppress error in that event. Could you please give example of those events
in this context?

--
Thanks,
Mahesh
Jul 12 '08 #2

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

Similar topics

4
4211
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox), SqlConnection (sqlConnection), SqlDataAdapter (daLookupData), SqlDataAdapter (daData), DataSet (dsLookupData), and DataSet (dsData), all created via the IDE during design-time. Here is the design of my simple tables: (An example since I can't post my...
0
991
by: Elmo Watson | last post by:
OK here's the scenario - GridView - populated with Object DataSource - technically no problem there (except what will be shown later in the post) Edit/Delete - first column - 'JobTypeID' - in the Main Table, it just uses the PK (int) from the JobTypes table - - DropDownList - inside one column's EditTemplate of the GridView - populated by another (db table) ObjectDataSource control. DataValueField=JobTypeID and DataTextField=JobType
1
1526
by: clickon | last post by:
I want to use the selected value of a drop down list to filter a data source. When i have done this before i have used a DataSourceControl and i have just made the drop down a control parameter, which works well. However this time i need to combine a set of results from two databases into a single data source so i need to use ADO to do it. The problem i come up against is that until the value in the drop ,down box is changed, the...
1
5407
by: clickon | last post by:
Forget about the controlParameter for the moment, for testing purposes i have created the following Markup: <asp:Table ID="tblSelectRoute" runat="server" CssClass="asp-table"> <asp:TableRow> <asp:TableCell CssClass="asp-table-header">Select Route<asp:Label ID="lblTest" runat="server"></asp:Label> </asp:TableCell>
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;
18
4985
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
10230
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...
0
10058
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10004
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
8886
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...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6678
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
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
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.