title: Error: SelectedValue which is invalid because it does not exist in the list of items
body: <p>I have a Gridview which binds to an ObjectDataSource (objStudentDetails). In edit/insert mode of the Gridview one of the fields is a DropDownList that gets it's pick list options from a lookup table. I have this DropDownList binding to another ObjectDataSource control (objStateList) which represents the lookup table. It works fine as long as the value in the objStudentDetails ObjectDataSource matches one of the values in the objStateList ObjectDataSource, at least in the case of a non empty string value anyway.</p>
  
  <p>The objStateList has these values (from the stored proc that loads it - ID#6 is an empty string ''):</p>
  
  <pre><code>StateId     State
  ----------- -----
  6             
  4           AL
  1           GA
  3           KY
  2           TN
  </code></pre>
  
  <p>The objStudentDetails has these values (from the stored proc that loads it):</p>
  
  <pre><code>FirstName   LastName   State
  ----------- ---------- -----
  tone        smith      TN
  </code></pre>
  
  <p>Or it could have this result set (State is an empty string - ''):</p>
  
  <pre><code>FirstName   LastName   State
  ----------- ---------- -----
  jenny       johnson     
  </code></pre>
  
  <p>In the first objStudentDetails resultset the state DropDownList in the EditItemTemplate shows up fine. In the second resultset, however, I get this error:</p>
  
  <pre><code>'ddlEditState' has a SelectedValue which is invalid because it does not exist in the list of items.
  Parameter name: value 
  </code></pre>
  
  <p>I would think that since my lookup table has a value with an empty string, that the objStudentDetails value with an empty string for state would match, but something isn't working the way I am expecting it to. </p>
  
  <p>Here is my EditItemTemplate code from the Gridview:</p>
  
  <pre><code>&lt;EditItemTemplate&gt;
    &lt;asp:Panel ID="panEditState" runat="server"&gt;
      &lt;asp:DropDownList ID="ddlEditState" runat="server" CssClass="GridviewDropdownlist"
        DataSourceID="objStateList" DataTextField="State" DataValueField="State"      
        SelectedValue='&lt;%# Bind("State") %&gt;'
        Width="50px"&gt;
  &lt;/asp:DropDownList&gt;
  &lt;/asp:Panel&gt;
  &lt;/EditItemTemplate&gt;
  </code></pre>
  
  <p>And the objStateList, which calls a method passing a parameter of which lookup table to query:</p>
  
  <pre><code>&lt;asp:ObjectDataSource ID="objStateList" runat="server" SelectMethod="GetDropdownData"     TypeName="AIMLibrary.BLL.DropdownData"&gt;
  &lt;SelectParameters&gt;
  &lt;asp:Parameter Name="itemsToGet" DefaultValue="state" /&gt;
  &lt;/SelectParameters&gt;
  &lt;/asp:ObjectDataSource&gt;
  </code></pre>
  
  <p>Any ideas?</p>