View Single Post
  #3 (permalink)  
Old March 6th, 2007, 04:43 PM
Aaron Edwards Aaron Edwards is offline
Friend of Wrox
 
Join Date: Apr 2004
Location: San Francisco, CA, USA.
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey thanks for the reply.

Here is the code for the ddl:
                                                    <asp:DropDownList Width="224px" ID="ddlFACID" runat="server">
</asp:DropDownList>

I searched the codebehind for anything that references the ddl and there isn't anything other than the code that I'm having problems with, which is...

Dim dvFac1 As DataView = dsLookupTables.Tables("Facilities").DefaultView
ddlFACID.DataSource = dvFac1
ddlFACID.DataValueField = "FacID"
ddlFACID.DataTextField = "FacilityName"
ddlFACID.DataBind()

The error that I get is "'ddlFACID' has a SelectedValue which is invalid because it does not exist in the list of items." When I debug I learn that the ddl for some reason already has a selectedValue of "57" (quotes included). Of course that is not in the dataView so it throws an error. The really weird thing is that I haven't even yet assigned a value to ddlFACID.SelectedValue. Ordinarily, I would do that right after binding to a data source.

Aaron


Reply With Quote