Drop down list in Form view returns error when value in bound field (data binding - ie. value exists in the database) does not have a value which is contained in the Datasource for the dropdown list

I get the following error when I click edit to edit the details in the web form:

'ddlUserRestrictionType' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value
 

 I would like it to accept any value which currently exists in the database.

 Is this easily achievable?

0
pizzamaker74
10/4/2006 4:22:53 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
1422 Views

Similar Articles

[PageSpeed] 16

With what you've posted, all I can tell is that you are trying to set the SelectedValue of a ddl to a value that does not exist in the list.  It would be helpful if you can post some code and the expected values of this control.


~ Tim
www.bucketofbits.com
www.tyleris.com
0
tmitch
10/4/2006 12:52:59 PM
Reply:

Similar Artilces:

Retaining Current Values Of DropDown List inside a Form View Control
I have two dropdownlist controls inside a formview control which lists the "genre" and "rating" for a video game.  The two dropdownlist are bound to an objectdatasource which extracts the "genre" item and "rating" item. I also set the property "AppendDataBoundItems" to "true" becaue i want the user to be able to change the current value of the list. With this in mind, i manually added "listitems" in order for the user to have a selection of all the "genre" and "rating" fields. My problem is when i ...

Drop down list control values OK but not showing selected value on UI
 Hi, I am having trouble with the following: ddlIndustry.Items.FindByText(oReader["industry"].ToString()).Selected = true;  I am trying to get the ddlIndustry drop down list to bind to a specific product industry got from a database like say "Agriculture". Even when i assign a hardwired and existent value like "Agriculture" as from the database,  the Selected value or text does change from initial option from the list with (this I verified in Debug mode) but when the page is generated, the Drop down list maintains value 0 and text "--select one --". Is there something i am...

Compare Dropdown list values to corresponding lookup values before binding in datagrid
how can i do this? does anyone know which event I would do it in?the problem is that the items in the lookup list (of users) keeps changing because it is stored in a database. i need to check that the values match so that the dropdownlist doesn't crash when the SelectedValue can't be found, hence if the value doesn't exist i can set it to something else.any ideas?  Hi,you can check if a value exists in DDL with code like thisDim litem As ListItem = DropDownList1.Items.FindByValue("value_to_look_for")If litem Is Nothing Then'goes here if the value wasn't f...

DropDown List DataSource for Options *AND* for DataSource Value in Database?
  I have a DropDown object list and so far I can set it to EITHER: 1) A SINGLE value (From table A using DataSource1)2) Multiple value options (From table B using DataSource2)  But how do I set both of the above? (i.e. set it to the value of option DataSource1 but allow the user to set it to any value in DataSource2)  Thanks ! wht do u mean?? binding dropdown to one datasource containg ds1 and ds2??Please remember to "Mark As Answer" if this post answered your question!Bilal Shouman - MCAD.NET|My Blog|--------------------------------- you can only bind...

how do i bind data from database using dropdown list inside the form view control
i'm using ASP.Net 2.0.i'm trying to create 1 asp page for bind the data from data base using dropdown list inside form view control.i'm using 2 dropdown list controls second DDL will bind the data depends on first DDL but i can't do.if any one is there to clear my doubt means send me the code in c# sharp language to my email address r this forum...thank u...   Regards, Aani Hi Aani, I wrote a detailed post with code you can look at for this, but using a gridview.  It's very similar.  Take a look. http://peterkellner.net/2007/12/13/grid...

how to add values in database using drop down list when the list is connected to a database column already????
hi there all.... well i am working on my web site.....i have inserted a drop down control which i have connected with my database table column....now i want to add the values in the same database column in other table connected with the primary key.....now can any one tell me the code as how to insert the values in the column from this drop own list control???? Hello: Could you please illustrate more on what you are trying to do? Do you want to store back the dropdownlist elements back to the database? Or what exactlt? RegardsBilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP...

populating the dropdown list with the values from the data base, Failing near adding the values todropdown
Here is My code' .aspx &nbsp;<asp:DropDownList ID="ddlkeyword" runat="server" Width="204px" >   </asp:DropDownList></td>   .aspx.cs   page_load() { fillddlkeyword(); }private void fillddlkeyword() {string StrSql = "Select distinct(formName)as formName from tbl_form"; oDB.RunDBQuery(StrSql, out oRS);DataTable dt = new DataTable(); dt.Columns.Add("Form");if (oRS.HasRows) {while (oRS.Read()) {DataRow dr = dt.NewRow(); dr["Form"] = oRS["formName"].ToString(); &n...

Gridview error when adding a dropdown list box for updated.
Hello all,  I have a gridview that I created and set the view to alow for edits and updates.  For the field that has the option to be updated I set that field to a templemt field so that this can be updated from a dropdown list box.  The problem that I am having is once I set the dropdown list box to binded to the field via "selectedvalue" to be updated when you select the Edit control when running I am getting the error: "'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name:...

Does the agregated funcion List(field) returns a SORTED list of not NULL field's values?
Hello... I have this SELECT statement: SELECT List(part) FROM invoice_detail WHERE delivered='N' GROUP BY invoice_no HAVING Count(invoice_no)>1 ORDER BY invoice_no Which returns me the following rows: BR122-L,BR122-S BR145-L,BR145-T STH1451,STH1452 STH1457,STH1458 STB3451,STB3452 ARK1345,ARK1346 KYR4670,KYR4671 What I would like is to be certain on having the items on the list always sorted. What can I do for it? Thanks. Version 9 introduced the ORDER BY clause to the LIST function: LIST "(" <expressio...

How to use values from two dropdown lists to get the value for a third dropdown?
I have three dropdown lists.  One for Office, one for Department, and a list of employees.   There is no relationship in the database between office and department.  The relationships are to the employees.  What I need to do is take the selected values from Office and Department, and run a query to get the list of employees who match both parameters (Office & Department).  Here's my code for the three dropdown lists.  How do I "connect" Office & Department to populate employees?  code from my vb.net page    for the ...

How to get the list of second drop-down-list based on value selected in the first drop-down-list
I have two drop-down-lists, the second one depends on the value chosen in the first drop-down-list.  In the first drop-down-list, I have AutoPostBack = "true" and OnSelectedIndexChanged = "SelectedIndexChanged" In the selectedIndexChanged method, I do the following: 1    protected void SelectedIndexChanged(object sender, EventArgs e)2        {3            if (IsPostBack)4            {5      &nbs...

adding values to the selected value in Dropdown list
 Hi,   I have dropdown box in my page which have some value inherted from the another list box in my page..Now in my second page , i have dropdown box with values and text value and list box... I'll be selecting the one value from the dropdown then i enter the value in text box and click on add button which will add the value in the list box like this i can able to add many value...now if i click on save button for the selected dropdpown item the added values in the listbox should be saved ...like this i add many values for many dropdown item and saved respectivelynow if c...

Can a DataSource set the default value in a DropDownList (or the list fetch the value from a DataSource)?
Hi I have a DropDownList that gets its values from a DataSource-control. Nothing magic so far. What makes me scratch my head is that I need to set the default (selected) value in the drop down. As the values come from a data source, I do not know the key/value/index of the default I. Is there a possibility to make the drop down "ask the data source" which key should be the default (that is, only if the drop down is populated the first time, of course)? Background: I have an application where an administrator can set the "standard" month that the application s...

dropdown list with 2 data value fields
DropdownList1.DataValueField = "ST_ID_NMBR" + "^" +"STATUS"; Hi, i need to have 2 values for the datavaluefield of a dropdownlist. hence i tried teh above statement,but it didnt work. Can anybody please tell me how to do it. Thanks  Hi check out these linkshttp://aspdotnetcodebook.blogspot.com/2009/03/how-to-display-hierarchical-data-in.html  http://aspdotnetcodebook.blogspot.com/2009/03/how-to-create-multi-column-dropdownlist.html http://aspdotnetcodebook.blogspot.com/2009/03/how-to-create-multicolum-dropdownlist.html Santosh kumarMark as Ans...

Dropdown list binds to previous datasource value
 I've created a custom drop down list by inheriting dropdownlist, and done a number of modifications to the DataSource property. The problem is that when I set the DataSource on the dropdown list it binds to the DataSource Previously set. Consider the following form:  My modified dropdownlist is on the left, Each of the buttons modifies the data source and causes the dropdownlist to databind. However only button 153 causes any values to appear in the list (this is intended). Here's a scenario:The page loads and the Drop Down List empty because no datasource has be...

Web resources about - Drop down list in Form view returns error when value in bound field (data binding - ie. value exists in the database) does not have a value which is contained in the Datasource for the dropdown list - asp.net.presentation-controls

Datasource - Wikipedia, the free encyclopedia
A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a different server, the property ...

Inverness Graham Acquires DataSource
Inverness Graham , a lower middle market private equity firm headquartered in suburban Philadelphia, has acquired DataSource , a print supply ...

SmartGlance for iPad for iPad on the iTunes App Store
Read reviews, get customer ratings, see screenshots, and learn more about SmartGlance for iPad on the App Store. Download SmartGlance for iPad ...

Chaitanya Pandit (@chaitanyapandit) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Data source - Wikipedia, the free encyclopedia
... Data source A data source is any of the following types of sources for (mostly) digitized data: a database in the Java software platform, datasource ...

2ndQuadrant - PostgreSQL expertise from specialists with a source code level understanding of RDBMS ...
PostgreSQL expertise from specialists with a source code level understanding of RDBMS PostgreSQL Planets Gabriele’s PlanetPostgreSQL Gianni’s ...

Tagged entries for CLOUD COMPUTING
Alan Williamson's output as a Java Champion, Blog-City Architect, BlueDragon Creator, Author, Speaker and Internet Guru

Private equity deals
... of biometric identity management systems, applications and services. www.crossmatch.com Inverness Graham Investment has acquired DataSource ...

C# C Sharp and Tutorials on C# Friends.com
Learn the c# langauge to build web applications using our online tutorials with live demos. Participate in our forums and learn from others. ...

JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX
DHTMLX offers a rich JavaScript library, UI components & HTML5 mobile framework. Build impressive web apps for both desktop and mobile devices. ...

Resources last updated: 12/14/2015 1:34:17 AM