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

Discussion in 'ASP .Net Web Controls' started by APA, Jul 13, 2006.

  1. APA

    APA Guest

    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.
    APA, Jul 13, 2006
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page