'StateList' has a SelectedValue which is invalid because it doesnot exist in the list of items.

A

APA

I'm getting this error when my page loads. The control is not a dependent control. Below is the
code used to populate the control.


IDataReader dr = DB.GetData("select Name, Abbrv from State");
StateList.DataSource = dr;
StateList.DataTextField = "Name";
StateList.DataValueField = "Abbrv";
error here ---> StateList.DataBind();


Here's the control declaration

<asp:DropDownList ID="StateList" runat="server"></asp:DropDownList>



This used to work and the only thing that changed is that an application in a subdirectory of the
website was changed so that it's not a separate application anymore. This is now happening on all
databound dropdownlist controls in the website.

I found many references to this problem but the scenarios all involve dependent controls or null
values in the data, neither of which is a problem in my case. I'm stumped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top