473,402 Members | 2,072 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Strange error binding DataTable to DropDownList: out of range... Parameter name: value

I'm getting a nonsensical error when binding a DataTable with one row
to a DropDownList.

The DataTable's row contains the fields "id" (INT), "description"
(VARCHAR) and with a couple other unused fields.

I'm binding the table in code behind:

DataTable table=Publishinggroup.GetPublisheegroups(person.Id );
ddlPublishSource.DataSource=table;
ddlPublishSource.DataBind();

And in the aspx page, it's:

<asp:DropDownList ID="ddlPublishSource" runat="server"
DataValueField="id" DataTextField="description" />

But the error that occurs on the DataBind() command is nonsensical,
because there are no column names and no values with a value of
"value":

Specified argument was out of the range of valid values. Parameter
name: value

Any ideas on what might cause that?

Thanks,

-Mike

Nov 18 '05 #1
1 2216
Hi-

Ok, I found the problem---the drop down list was having a value
preselected, before the datasource was assigned, but that value was no
longer in the datatable. That was why the bind was failing.

-Mike

On Wed, 07 Jul 2004 16:21:47 GMT, Mike Bridge <mi**@bridgecanada.com>
wrote:
I'm getting a nonsensical error when binding a DataTable with one row
to a DropDownList.


Nov 18 '05 #2

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

Similar topics

0
by: CGuy | last post by:
URGENT HELP REQUIRED FROM GURUS Hi, I have a custom object that implements ICollection and IListSource. This object has also an enumerator defined for it which implements IEnumerator and...
0
by: Shane O. Pinnell | last post by:
I am sure this has come up before, but I haven't been able to find an answer as of yet. That said, any help is definitely appreciated! I have a datagrid populated from a dataset. I have a...
9
by: Timm | last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative data binding wherever possible and trying to minimize the use of code. The list of values in DropDownList DDL2 should be...
5
by: tshad | last post by:
Here is the DropDown: <asp:DropDownList ID="ScreenTest" runat="server" /> Here is the code: ScreenTest.DataSource=objCmd.ExecuteReader ScreenTest.DataValueField="ScreenTemplateMasterID"...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
0
by: Tumurbaatar S. | last post by:
It's my first project using the Crystal report. I created a report with the report designer and linked it to a web form as: 1. put CrystalReportViewer in my page (its ID: Viewer). 2. put...
3
by: Jon Paal | last post by:
this text keeps showing up in my gridview dropdownlist "System.Data.DataRowView" How do I prevent this problem ?
2
by: Igor | last post by:
Hi I build a page that has a dropdownlist control bound with data from a database. When user select an item from the dropdownlist I want a label to be filled with a result from a stored...
6
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.